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"
3
3
4
- const nodeIdPlaceholder = `unique-id` ;
5
- const contentDigestPlaceholder = `unique-content-digest` ;
4
+ const nodeIdPlaceholder = `unique-id`
5
+ const contentDigestPlaceholder = `unique-content-digest`
6
6
7
- let gatsbyApi ;
7
+ let gatsbyApi
8
8
9
9
describe ( `sourceNodes` , ( ) => {
10
10
beforeEach ( ( ) => {
@@ -29,22 +29,21 @@ describe(`sourceNodes`, () => {
29
29
setStatus : jest . fn ( ) ,
30
30
} ) ,
31
31
} ,
32
- } ;
33
- } ) ;
32
+ }
33
+ } )
34
34
35
35
afterEach ( ( ) => {
36
- jest . resetAllMocks ( ) ;
37
- } ) ;
36
+ jest . resetAllMocks ( )
37
+ } )
38
38
39
39
describe ( `nodeBuilder` , ( ) => {
40
40
it ( `should create correct Author node` , ( ) => {
41
41
nodeBuilder ( {
42
42
gatsbyApi,
43
43
input : { type : `Author` , data : authorFixture } ,
44
- } ) ;
44
+ } )
45
45
46
- expect ( gatsbyApi . actions . createNode . mock . calls [ 0 ] [ 0 ] )
47
- . toMatchInlineSnapshot ( `
46
+ expect ( gatsbyApi . actions . createNode . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot ( `
48
47
{
49
48
"_id": 1,
50
49
"children": [],
@@ -56,13 +55,12 @@ describe(`sourceNodes`, () => {
56
55
"name": "Jay Gatsby",
57
56
"parent": null,
58
57
}
59
- ` ) ;
60
- } ) ;
58
+ ` )
59
+ } )
61
60
it ( `should create correct Post node` , ( ) => {
62
- nodeBuilder ( { gatsbyApi, input : { type : `Post` , data : postFixture } } ) ;
61
+ nodeBuilder ( { gatsbyApi, input : { type : `Post` , data : postFixture } } )
63
62
64
- expect ( gatsbyApi . actions . createNode . mock . calls [ 0 ] [ 0 ] )
65
- . toMatchInlineSnapshot ( `
63
+ expect ( gatsbyApi . actions . createNode . mock . calls [ 0 ] [ 0 ] ) . toMatchInlineSnapshot ( `
66
64
{
67
65
"alt": "brown and white long coated dog",
68
66
"children": [],
@@ -79,16 +77,15 @@ describe(`sourceNodes`, () => {
79
77
"url": "https://images.unsplash.com/photo-1615751072497-5f5169febe17?fm=jpg",
80
78
"width": 3024,
81
79
}
82
- ` ) ;
83
- } ) ;
84
- } ) ;
80
+ ` )
81
+ } )
82
+ } )
85
83
describe ( `createAssetNode` , ( ) => {
86
84
it ( `should create correct node shape` , ( ) => {
87
- const id = createAssetNode ( gatsbyApi , postImageFixture ) ;
85
+ const id = createAssetNode ( gatsbyApi , postImageFixture )
88
86
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 ( `
92
89
{
93
90
"alt": "brown and white long coated dog",
94
91
"children": [],
@@ -105,7 +102,7 @@ describe(`sourceNodes`, () => {
105
102
"url": "https://images.unsplash.com/photo-1615751072497-5f5169febe17?fm=jpg",
106
103
"width": 3024,
107
104
}
108
- ` ) ;
109
- } ) ;
110
- } ) ;
111
- } ) ;
105
+ ` )
106
+ } )
107
+ } )
108
+ } )
0 commit comments