From 9c0bb0fb1b3d694f8b3800c86d10bfe2c6d2802a Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 15:01:40 +0530 Subject: [PATCH] test for custom runs --- libs/remix-tests/tests/testRunner.cli.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index d045d8261f..e6de8a6762 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -90,5 +90,19 @@ Commands: // macth fail test details expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) }) + + test('remix-tests running a test file by enabling optimization and setting runs', () => { + const res = spawnSync(executablePath, ['--optimize', 'true', '--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) + // match initial lines + expect(res.stdout.toString().trim().includes('Optimization is enabled')).toBeTruthy() + expect(res.stdout.toString().trim().includes('Runs set to 300')).toBeTruthy() + expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) + // match test result + expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) + expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) + // macth fail test details + expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + }) }) }) \ No newline at end of file