Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
run(() => {
let done = assert.async();
let mock = mockReload('profile', 1).fails();
FactoryGuy.store.findRecord('profile', 1)
.catch(() => {
assert.equal(mock.timesCalled, 1);
assert.ok(true);
done();
}
);
});
});
run(() => {
let profile = make('profile', {description: "whatever", camelCaseDescription: "noodles"});
mockReload(profile).returns({attrs: {description: "moo"}});
profile.reload().then(function(reloaded) {
assert.ok(reloaded.id === profile.id, 'does not change id');
assert.ok(reloaded.get('description') === "moo", "attribute changed");
assert.ok(reloaded.get('camelCaseDescription') === "noodles", "other attributes are same");
done();
});
});
});
run(() => {
let done = assert.async();
let mock = mockReload('profile', 1).fails();
FactoryGuy.store.findRecord('profile', 1)
.catch(() => {
assert.equal(mock.timesCalled, 1);
assert.ok(true);
done();
}
);
});
});
run(() => {
let profile = make('profile', {description: "tomatoes", camelCaseDescription: "noodles"});
let newProfile = build('profile', {id: profile.get('id'), description: "potatoes", camelCaseDescription: "poodles"});
mockReload(profile).returns({json: newProfile});
profile.reload().then(function(reloaded) {
assert.ok(reloaded.id === profile.id, 'does not change id');
assert.ok(reloaded.get('description') === "potatoes", "description changed");
assert.ok(reloaded.get('camelCaseDescription') === "poodles", "camelCaseDescription changes");
done();
});
});
});
run(() => {
let profile = make('profile', {description: "whatever"});
mockReload(profile);
profile.reload().then(function(reloaded) {
assert.ok(reloaded.id === profile.id);
assert.ok(reloaded.get('description') === profile.get('description'));
done();
});
});
});
run(() => {
let profile = make('profile', {description: "whatever"});
mockReload(profile);
profile.reload().then(function(reloaded) {
assert.ok(reloaded.id === profile.id);
assert.ok(reloaded.get('description') === profile.get('description'));
done();
});
});
});