How to use the ember-data-factory-guy.mockQueryRecord function in ember-data-factory-guy

To help you get started, we’ve selected a few ember-data-factory-guy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github danielspaniel / ember-data-factory-guy / tests / unit / shared-adapter-behaviour.js View on Github external
test("when returning no result", async function(assert) {
    mockQueryRecord('user');

    FactoryGuy.store.queryRecord('user', {});

    assert.ok(true);
  });
github danielspaniel / ember-data-factory-guy / tests / unit / shared-adapter-behaviour.js View on Github external
test("when returning no result", async function(assert) {
    mockQueryRecord('user');

    FactoryGuy.store.queryRecord('user', {});

    assert.ok(true);
  });
github danielspaniel / ember-data-factory-guy / tests / unit / shared-adapter-behaviour.js View on Github external
run(async () => {
      let bob = make('user');
      mockQueryRecord('user', {name: 'Bob'}).returns({id: bob.id});

      let user = await FactoryGuy.store.queryRecord('user', {name: 'Bob'});
      assert.equal(user, bob, "returns the same user");
      assert.equal(FactoryGuy.store.peekAll('user').get('content').length, 1, "does not create a new model");
    });
  });
github danielspaniel / ember-data-factory-guy / tests / unit / shared-adapter-behaviour.js View on Github external
return run(async () => {

      let company1 = build('company'),
          company2 = build('company');

      mockQueryRecord('company', {name: 'Dude'}).returns({json: company1});
      mockQueryRecord('company', {type: 'Small'}).returns({json: company2});

      let company = await FactoryGuy.store.queryRecord('company', {name: 'Dude'});
      assert.equal(company.get('id'), company1.get('id'));

      company = await FactoryGuy.store.queryRecord('company', {type: 'Small'});
      assert.equal(company.get('id'), company2.get('id'));
    });
  });
github danielspaniel / ember-data-factory-guy / tests / unit / shared-adapter-behaviour.js View on Github external
run(async () => {
      let bob = make('user');
      mockQueryRecord('user', {name: 'Bob'}).returns({id: bob.id});

      let user = await FactoryGuy.store.queryRecord('user', {name: 'Bob'});
      assert.equal(user, bob, "returns the same user");
      assert.equal(FactoryGuy.store.peekAll('user').get('content').length, 1, "does not create a new model");
    });
  });
github danielspaniel / ember-data-factory-guy / tests / unit / shared-adapter-behaviour.js View on Github external
return run(async () => {
      let company1 = build('company'),
          company2 = build('company');

      let mockQuery = mockQueryRecord('company', {name: 'Dude'}).returns({json: company1});
      let company = await FactoryGuy.store.queryRecord('company', {name: 'Dude'});

      assert.equal(company.get('id'), company1.get('id'));

      mockQuery.withParams({type: 'Small'}).returns({json: company2});
      company = await FactoryGuy.store.queryRecord('company', {type: 'Small'});

      assert.equal(company.get('id'), company2.get('id'));
    });
  });