Skip to content

Commit

Permalink
Update tests to obtain signer from fakeProvider() instead of using fa…
Browse files Browse the repository at this point in the history
…keSigner() utility.
  • Loading branch information
derekpierre committed Aug 19, 2024
1 parent 3b70e39 commit 7705775
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 17 deletions.
6 changes: 3 additions & 3 deletions packages/pre/test/acceptance/alice-grants.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
bytesEqual,
fakePorterUri,
fakeProvider,
fakeSigner,
fakeUrsulas,
fromBytes,
mockGetUrsulas,
Expand Down Expand Up @@ -70,9 +69,10 @@ describe('story: alice shares message with bob through policy', () => {
startDate,
endDate,
};
const provider = fakeProvider();
policy = await alice.grant(
fakeProvider(),
fakeSigner(),
provider,
provider.getSigner(),
domains.DEVNET,
fakePorterUri,
policyParams,
Expand Down
3 changes: 1 addition & 2 deletions packages/pre/test/acceptance/delay-enact.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
bytesEqual,
fakePorterUri,
fakeProvider,
fakeSigner,
fakeUrsulas,
mockGetUrsulas,
} from '@nucypher/test-utils';
Expand Down Expand Up @@ -61,7 +60,7 @@ describe('story: alice creates a policy but someone else enacts it', () => {

const enacted = await preEnactedPolicy.enact(
provider,
fakeSigner(),
provider.getSigner(),
domains.DEVNET,
);
expect(enacted.txHash).toBeDefined();
Expand Down
10 changes: 3 additions & 7 deletions packages/taco/test/conditions/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import {
USER_ADDRESS_PARAM_DEFAULT,
USER_ADDRESS_PARAM_EXTERNAL_EIP4361,
} from '@nucypher/taco-auth';
import {
fakeAuthProviders,
fakeProvider,
fakeSigner,
} from '@nucypher/test-utils';
import { fakeAuthProviders, fakeProvider } from '@nucypher/test-utils';
import { ethers } from 'ethers';
import { beforeAll, describe, expect, it, vi } from 'vitest';

Expand Down Expand Up @@ -337,8 +333,8 @@ describe('No authentication provider', () => {
beforeAll(async () => {
await initialize();
provider = fakeProvider();
signer = fakeSigner();
authProviders = await fakeAuthProviders();
signer = provider.getSigner();
authProviders = await fakeAuthProviders(signer);
});

it('throws an error if there is no auth provider', () => {
Expand Down
5 changes: 2 additions & 3 deletions packages/taco/test/taco.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
fakeDkgFlow,
fakePorterUri,
fakeProvider,
fakeSigner,
fakeTDecFlow,
mockGetRitualIdFromPublicKey,
mockTacoDecrypt,
Expand Down Expand Up @@ -48,7 +47,7 @@ describe('taco', () => {
const mockedDkg = fakeDkgFlow(FerveoVariant.precomputed, 0, 4, 4);
const mockedDkgRitual = fakeDkgRitual(mockedDkg);
const provider = fakeProvider(aliceSecretKeyBytes);
const signer = fakeSigner(aliceSecretKeyBytes);
const signer = provider.getSigner();
const getFinalizedRitualSpy = mockGetActiveRitual(mockedDkgRitual);

const messageKit = await taco.encrypt(
Expand Down Expand Up @@ -110,7 +109,7 @@ describe('taco', () => {
const mockedDkg = fakeDkgFlow(FerveoVariant.precomputed, 0, 4, 4);
const mockedDkgRitual = fakeDkgRitual(mockedDkg);
const provider = fakeProvider(aliceSecretKeyBytes);
const signer = fakeSigner(aliceSecretKeyBytes);
const signer = provider.getSigner();
const getFinalizedRitualSpy = mockGetActiveRitual(mockedDkgRitual);

const customParamKey = ':nftId';
Expand Down
5 changes: 3 additions & 2 deletions packages/taco/test/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '@nucypher/shared';
import {
fakeDkgFlow,
fakeSigner,
fakeProvider,
fakeTDecFlow,
TEST_CHAIN_ID,
TEST_CONTRACT_ADDR,
Expand Down Expand Up @@ -84,11 +84,12 @@ export const fakeDkgTDecFlowE2E: (
) => {
const ritual = fakeDkgFlow(variant, ritualId, sharesNum, threshold);
const dkgPublicKey = ritual.dkg.publicKey();
const provider = fakeProvider();
const thresholdMessageKit = await encryptMessage(
message,
dkgPublicKey,
conditionExpr,
fakeSigner(),
provider.getSigner(),
);

const { decryptionShares } = fakeTDecFlow({
Expand Down

0 comments on commit 7705775

Please sign in to comment.