Skip to content

Commit b15497c

Browse files
committed
fixes
1 parent c74b2c0 commit b15497c

File tree

1 file changed

+25
-28
lines changed

1 file changed

+25
-28
lines changed

plugin/src/__tests__/source-nodes.ts

+25-28
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import { createAssetNode, nodeBuilder } from "../source-nodes";
2-
import { authorFixture, postFixture, postImageFixture } from "./fixtures";
1+
import { createAssetNode, nodeBuilder } from "../source-nodes"
2+
import { authorFixture, postFixture, postImageFixture } from "./fixtures"
33

4-
const nodeIdPlaceholder = `unique-id`;
5-
const contentDigestPlaceholder = `unique-content-digest`;
4+
const nodeIdPlaceholder = `unique-id`
5+
const contentDigestPlaceholder = `unique-content-digest`
66

7-
let gatsbyApi;
7+
let gatsbyApi
88

99
describe(`sourceNodes`, () => {
1010
beforeEach(() => {
@@ -29,22 +29,21 @@ describe(`sourceNodes`, () => {
2929
setStatus: jest.fn(),
3030
}),
3131
},
32-
};
33-
});
32+
}
33+
})
3434

3535
afterEach(() => {
36-
jest.resetAllMocks();
37-
});
36+
jest.resetAllMocks()
37+
})
3838

3939
describe(`nodeBuilder`, () => {
4040
it(`should create correct Author node`, () => {
4141
nodeBuilder({
4242
gatsbyApi,
4343
input: { type: `Author`, data: authorFixture },
44-
});
44+
})
4545

46-
expect(gatsbyApi.actions.createNode.mock.calls[0][0])
47-
.toMatchInlineSnapshot(`
46+
expect(gatsbyApi.actions.createNode.mock.calls[0][0]).toMatchInlineSnapshot(`
4847
{
4948
"_id": 1,
5049
"children": [],
@@ -56,13 +55,12 @@ describe(`sourceNodes`, () => {
5655
"name": "Jay Gatsby",
5756
"parent": null,
5857
}
59-
`);
60-
});
58+
`)
59+
})
6160
it(`should create correct Post node`, () => {
62-
nodeBuilder({ gatsbyApi, input: { type: `Post`, data: postFixture } });
61+
nodeBuilder({ gatsbyApi, input: { type: `Post`, data: postFixture } })
6362

64-
expect(gatsbyApi.actions.createNode.mock.calls[0][0])
65-
.toMatchInlineSnapshot(`
63+
expect(gatsbyApi.actions.createNode.mock.calls[0][0]).toMatchInlineSnapshot(`
6664
{
6765
"alt": "brown and white long coated dog",
6866
"children": [],
@@ -79,16 +77,15 @@ describe(`sourceNodes`, () => {
7977
"url": "https://images.unsplash.com/photo-1615751072497-5f5169febe17?fm=jpg",
8078
"width": 3024,
8179
}
82-
`);
83-
});
84-
});
80+
`)
81+
})
82+
})
8583
describe(`createAssetNode`, () => {
8684
it(`should create correct node shape`, () => {
87-
const id = createAssetNode(gatsbyApi, postImageFixture);
85+
const id = createAssetNode(gatsbyApi, postImageFixture)
8886

89-
expect(id).toEqual(nodeIdPlaceholder);
90-
expect(gatsbyApi.actions.createNode.mock.calls[0][0])
91-
.toMatchInlineSnapshot(`
87+
expect(id).toEqual(nodeIdPlaceholder)
88+
expect(gatsbyApi.actions.createNode.mock.calls[0][0]).toMatchInlineSnapshot(`
9289
{
9390
"alt": "brown and white long coated dog",
9491
"children": [],
@@ -105,7 +102,7 @@ describe(`sourceNodes`, () => {
105102
"url": "https://images.unsplash.com/photo-1615751072497-5f5169febe17?fm=jpg",
106103
"width": 3024,
107104
}
108-
`);
109-
});
110-
});
111-
});
105+
`)
106+
})
107+
})
108+
})

0 commit comments

Comments
 (0)