Skip to content

Commit

Permalink
refactor: prettify
Browse files Browse the repository at this point in the history
  • Loading branch information
RiccardoMolinari95 committed Dec 23, 2024
1 parent 4daa05b commit 903cb6c
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions ts/features/itwallet/machine/eid/__tests__/machine.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe("itwEidIssuanceMachine", () => {
trackWalletInstanceCreation,
trackWalletInstanceRevocation,
onInit: assign(onInit),
setIsReissuing : assign({
setIsReissuing: assign({
isReissuing: true
})
},
Expand Down Expand Up @@ -987,14 +987,13 @@ describe("itwEidIssuanceMachine", () => {
});

it("Should obtain an eID (SPID), reissuing mode", async () => {

//The wallet instance and attestation already exist
const initialContext = {
...InitialContext,
integrityKeyTag: T_INTEGRITY_KEY,
walletInstanceAttestation: T_WIA,
walletInstanceAttestation: T_WIA
};

const actor = createActor(mockedMachine);
actor.start();

Expand All @@ -1004,9 +1003,9 @@ describe("itwEidIssuanceMachine", () => {

expect(actor.getSnapshot().value).toStrictEqual("Idle");
expect(actor.getSnapshot().tags).toStrictEqual(new Set());

actor.send({ type: "start-reissuing" });

expect(actor.getSnapshot().value).toStrictEqual({
UserIdentification: "ModeSelection"
});
Expand Down Expand Up @@ -1122,43 +1121,43 @@ describe("itwEidIssuanceMachine", () => {
const initialSnapshot: MachineSnapshot = createActor(
itwEidIssuanceMachine
).getSnapshot();

const snapshot: MachineSnapshot = _.merge(undefined, initialSnapshot, {
value: { UserIdentification: "ModeSelection" },
context: {
isReissuing: true
}
} as MachineSnapshot);

const actor = createActor(mockedMachine, {
snapshot
});
actor.start();

actor.send({ type: "back" });

expect(actor.getSnapshot().value).toStrictEqual("Idle");
});

it("Should go back to IpzsPrivacyAcceptance state if isReissuing is false", async () => {
const initialSnapshot: MachineSnapshot = createActor(
itwEidIssuanceMachine
).getSnapshot();

const snapshot: MachineSnapshot = _.merge(undefined, initialSnapshot, {
value: { UserIdentification: "ModeSelection" },
context: {
isReissuing: false
}
} as MachineSnapshot);

const actor = createActor(mockedMachine, {
snapshot
});
actor.start();

actor.send({ type: "back" });

expect(actor.getSnapshot().value).toStrictEqual("IpzsPrivacyAcceptance");
});
});

0 comments on commit 903cb6c

Please sign in to comment.