From 6b952d34864ef840b6d42c582c1e2bed9c546f94 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Thu, 14 Jan 2021 14:50:35 +0530 Subject: [PATCH] test file result tests --- libs/remix-tests/tests/testRunner.cli.spec.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 2c347e5bb4..a203a0d0f5 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -31,5 +31,20 @@ Commands: help output usage information` expect(res.stdout.toString().trim()).toBe(expectedHelp) }) + + test('remix-tests running a test file', () => { + const res = spawnSync(executablePath, [resolve(__dirname + '/examples_0/assert_ok_test.sol')]) + // match initial lines + 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(/AssertOkTest/) + 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/) + expect(res.stdout.toString().trim()).toMatch(/expected value to be ok to: true/) + expect(res.stdout.toString().trim()).toMatch(/returned: false/) }) + }) }) \ No newline at end of file