From a3ad8ae5792bcdcbced15ee57a8702b53f93ae2d Mon Sep 17 00:00:00 2001 From: Antoine Boisier-Michaud <antoine.boisier-michaud@cactusoft.ca> Date: Mon, 12 Jul 2021 07:37:52 -0400 Subject: [PATCH 1/2] Update test workflow to run on pull requests --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a6d0d50..8b7fe93 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,6 @@ name: Test -on: [push] +on: [push, pull_request] jobs: unit-tests: From 68ae8784e7368d62cfa2b45bea4c4fa13232af21 Mon Sep 17 00:00:00 2001 From: Antoine Boisier-Michaud <antoine.boisier-michaud@cactusoft.ca> Date: Mon, 12 Jul 2021 07:38:37 -0400 Subject: [PATCH 2/2] Fix tests --- src/spec/assertion/arraysToBeEqual.spec.ts | 14 +++++++------- src/spec/assertion/toBeIn.spec.ts | 16 ++++++++-------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/spec/assertion/arraysToBeEqual.spec.ts b/src/spec/assertion/arraysToBeEqual.spec.ts index 866a537..bdde994 100644 --- a/src/spec/assertion/arraysToBeEqual.spec.ts +++ b/src/spec/assertion/arraysToBeEqual.spec.ts @@ -7,22 +7,22 @@ export class ExpectArraysToBeEqualTestSuite { @TestCase(`'a, b, c' and 'a, b, c'`, ['a', 'b', 'c'], ['a', 'b', 'c']) @TestCase(`empty arrays`, [], []) @TestCase(`arrays with undefined values`, [undefined, undefined], [undefined, undefined]) - private equal(actual, expected) { + public equal(actual, expected) { expect.arraysToBeEqual(actual, expected); } - + @Test('ReadonlyArrays to be equal') - private equal() { - const actual: ReaonlyArray<string> = ['a', 'b', 'c']; - const expected: ReaonlyArray<string> = ['a', 'b', 'c']; + public equalReadonly() { + const actual: readonly string[] = ['a', 'b', 'c']; + const expected: readonly string[] = ['a', 'b', 'c']; expect.arraysToBeEqual(actual, expected); - } + } @Test('Arrays to be equal, should fail') @TestCase(`'a, b, c' to equal 'b, c, a'`, ['a', 'b', 'c'], ['b', 'c', 'a']) @TestCase(`different lengths`, ['a', 'b', 'c', 'd'], ['a', 'b', 'c']) @TestCase(`different lengths, but the other way around`, ['a', 'b', 'c'], ['a', 'b', 'c', 'd']) - private unequal(actual, expected) { + public unequal(actual, expected) { expect.toThrow(() => { expect.arraysToBeEqual(actual, expected); }); diff --git a/src/spec/assertion/toBeIn.spec.ts b/src/spec/assertion/toBeIn.spec.ts index 8202198..e8dce0f 100644 --- a/src/spec/assertion/toBeIn.spec.ts +++ b/src/spec/assertion/toBeIn.spec.ts @@ -4,32 +4,32 @@ import { Test, TestSuite } from '../../testyCore'; @TestSuite('Expect ToBeIn Tests') export class ExpectToMatch { @Test(`'a' to be in, should succeed`) - private aToBeInSuccess() { + public aToBeInSuccess() { expect.toBeIn('a', ['a', 'b', 'c']); } - + @Test(`'a' to be in ReadonlyArray, should succeed`) - private aToBeInReadonlySuccess() { - const readonlyArray: ReaonlyArray<string> = ['a', 'b', 'c']; + public aToBeInReadonlySuccess() { + const readonlyArray: readonly string[] = ['a', 'b', 'c']; expect.toBeIn('a', readonlyArray); - } + } @Test(`'a' to be in, should fail`) - private aToBeInFail() { + public aToBeInFail() { expect.toThrow(() => { expect.toBeIn('a', ['b', 'c', 'd']); }); } @Test(`'a' not to be in, should fail`) - private aNotToBeInFail() { + public aNotToBeInFail() { expect.toThrow(() => { expect.not.toBeIn('a', ['a', 'b', 'c']); }); } @Test(`'a' not to be in, should succeed`) - private aNotToBeInSuccess() { + public aNotToBeInSuccess() { expect.not.toBeIn('a', ['b', 'c', 'd']); } }