Skip to content

Commit

Permalink
test(frontend): mockIdentity transformRequest (#3355)
Browse files Browse the repository at this point in the history
# Motivation

Spotted this check in NNS dapp which prevents the `mockIdentity` to be
used without knowing. Thought it can be interesting for future proof to
have it in OISY as well.
  • Loading branch information
peterpeterparker authored Nov 5, 2024
1 parent 346c9f2 commit ccc290c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/frontend/src/tests/mocks/identity.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ export const mockPrincipalText = 'xlmdg-vkosz-ceopx-7wtgu-g3xmd-koiyc-awqaq-7mod

export const mockPrincipal = Principal.fromText(mockPrincipalText);

const transformRequest = () => {
console.error(
'It looks like the agent is trying to make a request that should have been mocked at',
new Error().stack
);
throw new Error('Not implemented');
};

export const mockIdentity = {
getPrincipal: () => mockPrincipal
getPrincipal: () => mockPrincipal,
transformRequest
} as unknown as Identity;

// This is not linked/related to the mock above.
Expand Down

0 comments on commit ccc290c

Please sign in to comment.