Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test("handles hasMany relationships", function(assert) {
let projects = makeList('project', 1),
user = makeNew('user', {projects});
assert.deepEqual(user.get('projects').toArray(), projects.toArray(), 'hasMany projects');
});
test("handles belongsTo relationships", function(assert) {
let company = make('company'),
profile = makeNew('profile', {company});
assert.equal(profile.get('company'), company, 'belongsTo company');
});
run(async () => {
let description = "special description",
camelCaseDescription = "special camelcase description",
profile = makeNew('profile', {description, camelCaseDescription});
mockCreate(profile).match({camelCaseDescription, description});
await profile.save();
assert.ok(!profile.get('isNew'), 'Profile is saved');
assert.deepEqual(
profile.getProperties(['description', 'camelCaseDescription']),
{camelCaseDescription, description},
'correct model attributes present'
);
});
});
run(async () => {
let description = "special description",
camelCaseDescription = "special camelcase description",
profile = makeNew('profile', {description, camelCaseDescription});
mockCreate(profile).match({camelCaseDescription, description});
await profile.save();
assert.ok(!profile.get('isNew'), 'Profile is saved');
assert.deepEqual(
profile.getProperties(['description', 'camelCaseDescription']),
{camelCaseDescription, description},
'correct model attributes present'
);
});
});