Skip to content

Commit

Permalink
add check for the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusarich committed Mar 21, 2024
1 parent 7bf6af0 commit ed3ae39
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/feature-implicit-init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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);
});
});

0 comments on commit ed3ae39

Please sign in to comment.