question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

use-ember-get-and-set and model relationships test

See original GitHub issue

Consider this code in model unit test:

test('user relationship', function(assert) {
  const contact = this.store().modelFor('contact');
  const relationship = get(contact, 'relationshipsByName').get('user');
  assert.equal(relationship.key, 'user');
  assert.equal(relationship.kind, 'belongsTo');
});

This will throw an error because we’re not using Ember.get getter for the user property. But we can’t do it because relationshipsByName is an Ember.Map which has different get function.

My first idea was to add some optional settings to this rule where we would define particular preceding properties which shouldn’t throw an error.

I’m almost sure that this won’t be the only case, especially when we’re using some JQuery addons which can also have their own getters (for example pickadate.js).

WDYT?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jonpitchcommented, Oct 6, 2017

I have a use case where I often override mirage routes in a test in order to simulate different API results. For example:

//  /mirage/config.js
this.get('some/route', function() {
  return { status: 'ok' };
});

// /tests/acceptance/some-test.js
test('i want to verify what happens when the api throws a 500', function(assert) {
  server.get('some/route', function() {
    return new Mirage.Response(500, { }, {
      errors: [{
        code: '500',
        title: 'run for your life'
      }]
    });
  });

  // assert things
});

Currently server.get throws a linting error. Has there been any discussion about a whitelist functionality or ignoring server.get entirely? This is listed in the Mirage docs. My current workaround is to:

const { get: GET } = server;
GET('some/route', ...);
0reactions
netescommented, May 23, 2017

I think so 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

The E&P Relationship Test - Hypnosis Motivation Institute
Taking this test is the first step in your discovery of Dr. John Kappas' revolutionary “E&P” model explaining how our subconscious mind dictates...
Read more >
Topic 3: Use Functions to Model Relationships Quiz - Quizizz
Play this game to review Pre-algebra. Does the relation represent a function? (1, 3), (2, 5), (3, 7), (4, 9)
Read more >
Attachment Style Quiz: Free & Fast Attachment Style Test
Free and quick (5 minutes) attachment style quiz to explore how childhood conditioning can cause you to struggle with adult relationships.
Read more >
Relationship Attachment Style Test - Psychology Today
The main attachment styles covered in this test are Secure, Anxious-Ambivalent, Dismissive-Avoidant, Fearful-Avoidant, Dependent, and Codependent. Find out what ...
Read more >
Quizzes to strengthen your relationships - Love Languages
Quizzes to strengthen your relationships. Join the millions that have discovered the secrets to better relationships. Love Language Quiz ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found