From e2327a24518656bb52a573878365d15f817260cc Mon Sep 17 00:00:00 2001 From: benesjan Date: Mon, 26 Feb 2024 10:56:20 +0000 Subject: [PATCH] double initialization test --- yarn-project/end-to-end/src/e2e_state_vars.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/yarn-project/end-to-end/src/e2e_state_vars.test.ts b/yarn-project/end-to-end/src/e2e_state_vars.test.ts index b33f5f04560..6365d289bc4 100644 --- a/yarn-project/end-to-end/src/e2e_state_vars.test.ts +++ b/yarn-project/end-to-end/src/e2e_state_vars.test.ts @@ -35,6 +35,14 @@ describe('e2e_state_vars', () => { const receipt2 = await contract.methods.match_shared_immutable(s.account, s.points).send().wait(); expect(receipt2.status).toEqual(TxStatus.MINED); }, 200_000); + + it('initializing SharedImmutable the second time should fail', async () => { + // Jest executes the tests sequentially and the first call to initialize_shared_immutable was executed + // in the previous test, so the call bellow should fail. + await expect(contract.methods.initialize_shared_immutable(1).send().wait()).rejects.toThrowError( + "Assertion failed: SharedImmutable already initialized 'fields_read[0] == 0'", + ); + }, 100_000); }); describe('PrivateMutable', () => {