Skip to content

Commit e3540d4

Browse files
committed
chore: enhance deprecated test assertions
1 parent 5025a21 commit e3540d4

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

src/createSchemaCustomization/customizeSitePageContext.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ describe('customizeSitePageContext', () => {
88
},
99
};
1010
customizeSitePageContext(argsMock);
11-
expect(argsMock.actions.createTypes).toBeCalled();
11+
expect(argsMock.actions.createTypes).toHaveBeenCalled();
1212
});
1313
});

src/onCreatePage/translatePage.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe('translatePage', () => {
5050
};
5151
translatePage({ page, actions } as any, options);
5252

53-
expect(actions.deletePage).toBeCalledWith(page);
53+
expect(actions.deletePage).toHaveBeenCalledWith(page);
5454
expect(actions.createPage).toHaveBeenCalledTimes(3);
5555
expect(actions.createPage).toHaveBeenNthCalledWith(1, {
5656
...page,
@@ -118,7 +118,7 @@ describe('translatePage', () => {
118118
};
119119
translatePage({ page, actions } as any, options);
120120

121-
expect(actions.deletePage).toBeCalledWith(page);
121+
expect(actions.deletePage).toHaveBeenCalledWith(page);
122122
expect(actions.createPage).toHaveBeenCalledTimes(1);
123123
expect(actions.createPage).toHaveBeenNthCalledWith(1, {
124124
...page,
@@ -139,7 +139,7 @@ describe('translatePage', () => {
139139
};
140140
translatePage({ page, actions } as any, options);
141141

142-
expect(actions.deletePage).toBeCalledWith(page);
142+
expect(actions.deletePage).toHaveBeenCalledWith(page);
143143
expect(actions.createPage).toHaveBeenCalledTimes(1);
144144
expect(actions.createPage).toHaveBeenNthCalledWith(1, {
145145
...page,
@@ -162,7 +162,7 @@ describe('translatePage', () => {
162162
};
163163
translatePage({ page, actions } as any, options);
164164

165-
expect(actions.deletePage).toBeCalledWith(page);
165+
expect(actions.deletePage).toHaveBeenCalledWith(page);
166166
expect(actions.createPage).toHaveBeenCalledTimes(1);
167167
expect(actions.createPage).toHaveBeenNthCalledWith(1, {
168168
...page,
@@ -186,7 +186,7 @@ describe('translatePage', () => {
186186
};
187187
translatePage({ page, actions } as any, options);
188188

189-
expect(actions.deletePage).toBeCalledWith(page);
189+
expect(actions.deletePage).toHaveBeenCalledWith(page);
190190
expect(actions.createPage).toHaveBeenCalledTimes(1);
191191
expect(actions.createPage).toHaveBeenNthCalledWith(1, {
192192
...page,
@@ -217,7 +217,7 @@ describe('translatePage', () => {
217217
};
218218
translatePage({ page, actions } as any, options);
219219

220-
expect(actions.deletePage).toBeCalledWith(page);
220+
expect(actions.deletePage).toHaveBeenCalledWith(page);
221221
expect(actions.createPage).toHaveBeenCalledTimes(1);
222222
expect(actions.createPage).toHaveBeenNthCalledWith(1, {
223223
...page,
@@ -252,8 +252,8 @@ describe('translatePage', () => {
252252

253253
translatePage({ page, actions } as any, options);
254254

255-
expect(actions.deletePage).not.toBeCalled();
256-
expect(actions.createPage).not.toBeCalled();
255+
expect(actions.deletePage).not.toHaveBeenCalled();
256+
expect(actions.createPage).not.toHaveBeenCalled();
257257
});
258258

259259
it('should obey page blacklists', () => {

src/onRenderBody.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ describe('onRenderBody', () => {
1616
);
1717
}
1818

19-
expect(setHtmlAttributesMock).toBeCalledTimes(0);
20-
expect(setHeadComponentsMock).toBeCalledTimes(0);
19+
expect(setHtmlAttributesMock).toHaveBeenCalledTimes(0);
20+
expect(setHeadComponentsMock).toHaveBeenCalledTimes(0);
2121
});
2222
it('should set i18n meta data', () => {
2323
const loadPageDataSyncMock = jest.fn().mockReturnValue({
@@ -49,7 +49,7 @@ describe('onRenderBody', () => {
4949
);
5050
}
5151

52-
expect(setHtmlAttributesMock).toBeCalledWith({ lang: 'de-CH' });
52+
expect(setHtmlAttributesMock).toHaveBeenCalledWith({ lang: 'de-CH' });
5353
expect(setHeadComponentsMock).toMatchInlineSnapshot(`
5454
[MockFunction] {
5555
"calls": [

src/sourceNodes/sourceTranslationNodes.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ describe('sourceTranslationNodes', () => {
5454
3,
5555
expect.objectContaining({ key: 'key', message: '价值', locale: 'zh-CN' }),
5656
);
57-
expect(argsMock.createNodeId).toBeCalledTimes(3);
58-
expect(argsMock.createContentDigest).toBeCalledTimes(3);
57+
expect(argsMock.createNodeId).toHaveBeenCalledTimes(3);
58+
expect(argsMock.createContentDigest).toHaveBeenCalledTimes(3);
5959
});
6060
});

0 commit comments

Comments
 (0)