From ed3ae39ad1434f1fa05f76915d7b53e38e665229 Mon Sep 17 00:00:00 2001 From: Gusarich Date: Thu, 21 Mar 2024 18:37:53 +0300 Subject: [PATCH] add check for the error message --- src/test/feature-implicit-init.spec.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/test/feature-implicit-init.spec.ts b/src/test/feature-implicit-init.spec.ts index fb5af3af9..de50a1197 100644 --- a/src/test/feature-implicit-init.spec.ts +++ b/src/test/feature-implicit-init.spec.ts @@ -3,11 +3,25 @@ import { ContractSystem } from '@tact-lang/emulator'; import { __DANGER_resetNodeId } from '../grammar/ast'; import { MyContract } from './features/output/implicit-init_MyContract'; import { run } from '../node'; +import { consoleLogger } from '../logger'; describe('feature-send', () => { + beforeAll(() => { + jest.spyOn(consoleLogger, 'error').mockImplementation(() => {}); + }); + beforeEach(() => { __DANGER_resetNodeId(); }); + + afterAll(() => { + (consoleLogger.error as jest.Mock).mockRestore(); + }); + + afterEach(() => { + (consoleLogger.error as jest.Mock).mockClear(); + }); + it('should deploy', async () => { // Init const system = await ContractSystem.create(); @@ -23,6 +37,7 @@ describe('feature-send', () => { expect(await contract.getGetCounter()).toBe(0n); expect(tracker.collect()).toMatchSnapshot(); }); + it('should increment counter', async () => { // Init const system = await ContractSystem.create(); @@ -52,6 +67,9 @@ describe('feature-send', () => { configPath: __dirname + '/test-tact.config.json', projectNames: ['implicit-init-2'], }); + expect((consoleLogger.error as jest.Mock).mock.lastCall[0]).toContain( + 'Field test_field is not set' + ); expect(result).toBe(false); }); });