Skip to content

Commit

Permalink
Replace deprecated toBeCalled/toBeCalledWith (#2950)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnasnainaec authored Mar 8, 2024
1 parent 842fecf commit 39f719a
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/AppBar/tests/Logo.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ beforeAll(() => {
describe("Logo", () => {
it("navigates to Project Screen on click", () => {
testRenderer.root.findByType(Button).props.onClick();
expect(mockNavigate).toBeCalledWith(Path.ProjScreen);
expect(mockNavigate).toHaveBeenCalledWith(Path.ProjScreen);
});
});
2 changes: 1 addition & 1 deletion src/components/DataEntry/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("DataEntry", () => {

it("fetches domain", async () => {
await renderDataEntry({ currentDomain: mockDomain });
expect(mockGetSemanticDomainFull).toBeCalledWith(
expect(mockGetSemanticDomainFull).toHaveBeenCalledWith(
mockDomain.id,
mockDomain.lang
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Login/tests/Login.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ describe("Login", () => {
});
expect(fieldPass.props.error).toBeFalsy();
expect(fieldUser.props.error).toBeTruthy();
expect(mockAsyncLogIn).not.toBeCalled();
expect(mockAsyncLogIn).not.toHaveBeenCalled();
});

it("errors when no password", async () => {
Expand All @@ -82,7 +82,7 @@ describe("Login", () => {
});
expect(fieldPass.props.error).toBeTruthy();
expect(fieldUser.props.error).toBeFalsy();
expect(mockAsyncLogIn).not.toBeCalled();
expect(mockAsyncLogIn).not.toHaveBeenCalled();
});

it("submits when username and password", async () => {
Expand All @@ -97,7 +97,7 @@ describe("Login", () => {
});
expect(fieldPass.props.error).toBeFalsy();
expect(fieldUser.props.error).toBeFalsy();
expect(mockAsyncLogIn).toBeCalled();
expect(mockAsyncLogIn).toHaveBeenCalled();
});
});
});
4 changes: 2 additions & 2 deletions src/components/Login/tests/Signup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ const submitAndCheckError = async (id?: SignupId): Promise<void> => {

// Expect signUp only when no field expected to error.
if (id === undefined) {
expect(mockAsyncSignUp).toBeCalled();
expect(mockAsyncSignUp).toHaveBeenCalled();
} else {
expect(mockAsyncSignUp).not.toBeCalled();
expect(mockAsyncSignUp).not.toHaveBeenCalled();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ describe("ProjectAutocomplete", () => {
await renderAutocomplete();
const selectChange = testRenderer.root.findByType(Select).props.onChange;
await renderer.act(async () => selectChange({ target: { value: "Off" } }));
expect(mockUpdateProject).toBeCalledWith({
expect(mockUpdateProject).toHaveBeenCalledWith({
...mockProject,
autocompleteSetting: AutocompleteSetting.Off,
});
await renderer.act(async () => selectChange({ target: { value: "On" } }));
expect(mockUpdateProject).toBeCalledWith({
expect(mockUpdateProject).toHaveBeenCalledWith({
...mockProject,
autocompleteSetting: AutocompleteSetting.On,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe("ProjectLanguages", () => {
.findByProps({ id: "analysis-language-new-confirm" })
.props.onClick();
});
expect(mockUpdateProject).toBeCalledWith(
expect(mockUpdateProject).toHaveBeenCalledWith(
mockProject([...mockAnalysisWritingSystems, newLang])
);
});
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProjectSettings/tests/ProjectName.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("ProjectName", () => {
textField.props.onChange({ target: { value: name } })
);
await renderer.act(async () => saveButton.props.onClick());
expect(mockUpdateProject).toBeCalledWith({ ...mockProject, name });
expect(mockUpdateProject).toHaveBeenCalledWith({ ...mockProject, name });
});

it("toasts on error", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ describe("TreeViewActions", () => {
treeViewState: nonDefaultState,
});
await store.dispatch(initTreeDomain(mockLang));
expect(mockGetSemDomTreeNode).toBeCalledWith(mockId, mockLang);
expect(mockGetSemDomTreeNode).toHaveBeenCalledWith(mockId, mockLang);
});
});
});
2 changes: 1 addition & 1 deletion src/utilities/tests/dictionaryLoader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("DictionaryLoader", () => {
const loader = new DictionaryLoader(bcp47);
expect(loader.lang === bcp47);
expect(mockGetKeys).toHaveBeenCalledTimes(1);
expect(mockGetKeys).toBeCalledWith(bcp47);
expect(mockGetKeys).toHaveBeenCalledWith(bcp47);
});
});

Expand Down

0 comments on commit 39f719a

Please sign in to comment.