Skip to content

Commit

Permalink
test(jest): fix old unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sdisalvo-crd committed May 9, 2024
1 parent d9c401c commit 3e782d1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
10 changes: 2 additions & 8 deletions src/store/reducers/identifiersCache/identifiersCache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ describe("identifiersCacheSlice", () => {
const initialState = {
identifiers: [],
favourites: [],
multiSigGroup: {
groupId: "",
connections: [],
},
multiSigGroup: undefined,
};
it("should return the initial state", () => {
expect(
Expand Down Expand Up @@ -77,10 +74,7 @@ describe("identifiersCacheSlice", () => {
time: 1,
},
],
multiSigGroup: {
groupId: "",
connections: [],
},
multiSigGroup: undefined,
};
const newState = identifiersCacheSlice.reducer(
initialState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const IdentifierStage2 = ({
<img
src={connection?.logo || KeriLogo}
className="connection-logo"
data-testid="identifier-stage-1-logo"
data-testid="identifier-stage-2-logo"
alt="connection-logo"
/>
<span className="connection-name">{connection.label}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import configureStore from "redux-mock-store";
import { Provider } from "react-redux";
import { IdentifierThemeSelector } from "./IdentifierThemeSelector";
import { connectionsFix } from "../../../__fixtures__/connectionsFix";
import { IdentifierStage1 } from "./IdentifierStage1";
import { IdentifierStage3 } from "./IdentifierStage3";
import { filteredIdentifierFix } from "../../../__fixtures__/filteredIdentifierFix";
import { IdentifierStage4 } from "./IdentifierStage4";
import { IdentifierStage2 } from "./IdentifierStage2";

describe("Identifier Theme Selector", () => {
test("It switches KERI card from theme 0 to theme 1", async () => {
Expand Down Expand Up @@ -60,17 +60,22 @@ describe("Render Identifier Stage", () => {
dispatch: dispatchMock,
};

test("Fallback connection logo for identifier stage 1", async () => {
test("Fallback connection logo for identifier stage 2", async () => {
const { getByTestId } = render(
<Provider store={storeMocked}>
<IdentifierStage1
<IdentifierStage2
state={{
identifierCreationStage: 1,
displayNameValue: "Duke",
selectedAidType: 1,
selectedTheme: 1,
threshold: 1,
scannedConections: [],
scannedConections: [
{
...connectionsFix[5],
logo: "",
},
],
selectedConnections: [],
ourIdentifier: "",
newIdentifier: {
Expand All @@ -84,20 +89,20 @@ describe("Render Identifier Stage", () => {
}}
resetModal={jest.fn()}
setState={jest.fn()}
componentId="11"
componentId="create-identifier-modal"
/>
</Provider>
);

expect(getByTestId("identifier-stage-1-logo").getAttribute("src")).not.toBe(
expect(getByTestId("identifier-stage-2-logo").getAttribute("src")).not.toBe(
undefined
);
});

test("Fallback connection logo identifier stage 3", async () => {
test("Fallback connection logo identifier stage 4", async () => {
const { getByTestId } = render(
<Provider store={storeMocked}>
<IdentifierStage3
<IdentifierStage4
state={{
identifierCreationStage: 1,
displayNameValue: "Duke",
Expand All @@ -123,7 +128,7 @@ describe("Render Identifier Stage", () => {
}}
resetModal={jest.fn()}
setState={jest.fn()}
componentId="11"
componentId="create-identifier-modal"
/>
</Provider>
);
Expand Down

0 comments on commit 3e782d1

Please sign in to comment.