Created
October 1, 2018 14:39
-
-
Save alexdiliberto/ff500cc04e568b873a1ca3046dc75263 to your computer and use it in GitHub Desktop.
EmberJS Testing - Mock network request in test body using Pretender
This file contains hidden or 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
test('it renders', async function(assert) { | |
let server = new Pretender(); | |
server.get('https://my-api', () => { | |
return [200, {}, JSON.stringify({ | |
items: [ | |
{ | |
name: 'jim', | |
waffles: 1 | |
}, | |
{ | |
name: 'jane', | |
waffles: 2 | |
}, | |
] | |
})]; | |
}); | |
await render(hbs`{{waffles-component}}`); | |
assert.dom('[data-test-id="list-item"]').exists({ count: 2 }); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment