Skip to content

Commit 2895a7f

Browse files
committed
Replace post model with note to increase clarity
1 parent ae9e66e commit 2895a7f

15 files changed

Lines changed: 54 additions & 54 deletions

File tree

tests/dummy/app/pods/docs/network-mocking/template.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ It makes sense that we would also want to mock the network while running FastBoo
66

77
FastBoot Testing exposes an API for intercepting requests made from your FastBoot app.
88

9-
The following example shows how to mock a test that fetches blog post data.
9+
The following example shows how to mock a test that fetches note data.
1010

1111
```js
1212
import { module, test } from 'qunit';
1313
import { setup, visit, mockServer } from 'ember-cli-fastboot-testing/test-support';
1414

15-
module('Fastboot | Blog post page', function(hooks) {
15+
module('Fastboot | Note page', function(hooks) {
1616
setup(hooks);
1717

18-
test('it can render a blog post', async function(assert) {
19-
await mockServer.get('/api/posts/1', {
18+
test('it can render a note', async function(assert) {
19+
await mockServer.get('/api/notes/1', {
2020
data: {
21-
type: 'post',
21+
type: 'note',
2222
id: '1',
2323
attributes: {
2424
title: 'Hello world!'
2525
}
2626
}
2727
});
2828

29-
await visit('/posts/1');
29+
await visit('/notes/1');
3030

3131
assert.dom('[data-test-id="title"]').hasText("Hello world!");
3232
});
@@ -38,14 +38,14 @@ The `mockServer#get` method maps a URL to a response for the lifecycle of the te
3838
By default, the `mockServer` will use a status code of 200. However, an optional status code can be passed in as the third parameter.
3939

4040
```js
41-
test('it renders the 404 page when it cannot fetch a blog post', async function(assert) {
41+
test('it renders the 404 page when it cannot fetch a note', async function(assert) {
4242
await mockServer.get(
43-
'/api/posts/1',
44-
{ error: 'Post not found' },
43+
'/api/notes/1',
44+
{ error: 'Note not found' },
4545
404
4646
);
4747

48-
await visit('/posts/1');
48+
await visit('/notes/1');
4949

5050
assert.dom('[data-test-id="page-not-found"]').exists();
5151
});

tests/dummy/app/pods/examples/network/posts/index/route.js renamed to tests/dummy/app/pods/examples/network/notes/index/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Route from '@ember/routing/route';
33
export default Route.extend({
44

55
async model() {
6-
return this.store.findAll('post');
6+
return this.store.findAll('note');
77
}
88

99
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
The data loaded from the server is:
2+
3+
{{#each model as |note|}}
4+
<div data-test-id="title-{{note.id}}">
5+
{{note.title}}
6+
</div>
7+
{{/each}}

tests/dummy/app/pods/examples/network/posts/post/route.js renamed to tests/dummy/app/pods/examples/network/notes/note/route.js

File renamed without changes.

tests/dummy/app/pods/examples/network/posts/post/template.hbs renamed to tests/dummy/app/pods/examples/network/notes/note/template.hbs

File renamed without changes.

tests/dummy/app/pods/examples/network/other/get-request/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fetch from 'fetch';
44
export default Route.extend({
55

66
async model() {
7-
let response = await fetch('/api/posts', { method: 'post' });
7+
let response = await fetch('/api/notes', { method: 'post' });
88
return await response.json();
99
}
1010

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The data loaded from the server is:
22

3-
{{#each model as |post|}}
4-
<div data-test-id="title-{{post.id}}">
5-
{{post.title}}
3+
{{#each model as |note|}}
4+
<div data-test-id="title-{{note.id}}">
5+
{{note.title}}
66
</div>
77
{{/each}}

tests/dummy/app/pods/examples/network/other/post-request/route.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fetch from 'fetch';
44
export default Route.extend({
55

66
async model() {
7-
let response = await fetch('/api/posts', { method: 'post' });
7+
let response = await fetch('/api/notes', { method: 'post' });
88
return await response.json();
99
}
1010

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The data loaded from the server is:
22

3-
{{#each model as |post|}}
4-
<div data-test-id="title-{{post.id}}">
5-
{{post.title}}
3+
{{#each model as |note|}}
4+
<div data-test-id="title-{{note.id}}">
5+
{{note.title}}
66
</div>
77
{{/each}}

0 commit comments

Comments
 (0)