Last active
October 23, 2018 14:58
-
-
Save amk221/ead2595597fe80c5e0ede8ebc664b02e to your computer and use it in GitHub Desktop.
ED test failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RESTAdapter from 'ember-data/adapters/rest'; | |
export default RESTAdapter.extend(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from 'ember-data/model'; | |
import attr from 'ember-data/attr'; | |
import { belongsTo, hasMany } from 'ember-data/relationships'; | |
export default Model.extend({ | |
name: attr('string') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Model from 'ember-data/model'; | |
import attr from 'ember-data/attr'; | |
import { belongsTo, hasMany } from 'ember-data/relationships'; | |
export default Model.extend({ | |
name: attr('string'), | |
bar: belongsTo('bar') | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import RESTSerializer from 'ember-data/serializers/rest'; | |
export default RESTSerializer.extend(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Application from '../app'; | |
import config from '../config/environment'; | |
import { setApplication } from '@ember/test-helpers'; | |
import { start } from 'ember-qunit'; | |
import { assign } from '@ember/polyfills'; | |
let attributes = assign({ rootElement: '#main' }, config.APP); | |
setApplication(Application.create(attributes)); | |
start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { moduleFor, test } from 'ember-qunit'; | |
import Ember from 'ember'; | |
const { getOwner, run } = Ember; | |
moduleFor('route:my-route', { | |
needs: [ | |
'adapter:application', | |
'serializer:application', | |
'model:foo', | |
'model:bar' | |
] | |
}); | |
test('rels', function(assert) { | |
const owner = getOwner(this); | |
const store = owner.lookup('service:store'); | |
const adapter = owner.lookup('adapter:application'); | |
store.pushPayload({ | |
foos: [{ | |
id: '1', | |
name: 'Foo 1', | |
bar: '1' | |
}], | |
bars: [{ | |
id: '1', | |
name: 'Bar 1' | |
}, { | |
id: '2', | |
name: 'Bar 2' | |
}] | |
}); | |
const foo = store.peekRecord('foo', 1); | |
const bar = store.peekRecord('bar', 1); | |
run(() => { | |
foo.belongsTo('bar').push({ | |
data: { | |
type: 'bar', | |
id: '2' | |
} | |
}); | |
}); | |
foo.get('bar').then(fooBar => { | |
assert.deepEqual(fooBar.serialize(), { | |
name: 'Bar 2' | |
}); | |
}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.15.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": true | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.4.3", | |
"ember-template-compiler": "3.4.3", | |
"ember-testing": "3.4.3" | |
}, | |
"addons": { | |
"ember-data": "3.4.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment