Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alexdiliberto/ff500cc04e568b873a1ca3046dc75263 to your computer and use it in GitHub Desktop.
Save alexdiliberto/ff500cc04e568b873a1ca3046dc75263 to your computer and use it in GitHub Desktop.
EmberJS Testing - Mock network request in test body using Pretender
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