From 603fcd4f6279d0e3625d450910c2574ea73bb579 Mon Sep 17 00:00:00 2001 From: David Golightly Date: Fri, 10 Nov 2023 09:43:55 -0800 Subject: [PATCH] remove chai & mocha --- package.json | 4 ---- test/lib/utils.ts | 28 ++++++++-------------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 2aca033d..c49a32eb 100644 --- a/package.json +++ b/package.json @@ -51,14 +51,11 @@ }, "devDependencies": { "@types/assert": "^1.4.3", - "@types/chai": "^4.2.7", "@types/jest": "^29.5.8", - "@types/mocha": "^9.1.1", "@types/mockdate": "^3.0.0", "@types/node": "^17.0.41", "@typescript-eslint/eslint-plugin": "^5.27.1", "@typescript-eslint/parser": "^5.27.1", - "chai": "^4.2.0", "coverage": "^0.4.1", "eslint": "^8.17.0", "eslint-config-prettier": "^8.5.0", @@ -68,7 +65,6 @@ "husky": "^8.0.1", "jest": "^29.7.0", "lint-staged": "^13.0.1", - "mocha": "^10.0.0", "mockdate": "^3.0.5", "nyc": "^15.1.0", "prettier": "^2.6.2", diff --git a/test/lib/utils.ts b/test/lib/utils.ts index 6d4c2fe8..6bb2b93f 100644 --- a/test/lib/utils.ts +++ b/test/lib/utils.ts @@ -11,17 +11,13 @@ export const TEST_CTX = { const assertDatesEqual = function ( actual: Date | Date[], - expected: Date | Date[], - msg?: string + expected: Date | Date[] ) { - msg = msg ? ' [' + msg + '] ' : '' - if (!(actual instanceof Array)) actual = [actual] if (!(expected instanceof Array)) expected = [expected] if (expected.length > 1) { expect(actual).toHaveLength(expected.length) - msg = ' - ' } for (let i = 0; i < expected.length; i++) { @@ -133,7 +129,7 @@ export const testRecurring = function ( const string2 = rrule2.toString() expect(str).toBe(string2) if (method === 'all') { - assertDatesEqual(rrule2.all(), expectedDates, 'fromString().all()') + assertDatesEqual(rrule2.all(), expectedDates) } } @@ -171,8 +167,7 @@ export const testRecurring = function ( expectedDates[expectedDates.length - 1], true ), - expectedDates, - 'between, inc=true' + expectedDates ) assertDatesEqual( @@ -181,8 +176,7 @@ export const testRecurring = function ( expectedDates[expectedDates.length - 1], false ), - expectedDates.slice(1, expectedDates.length - 1), - 'between, inc=false' + expectedDates.slice(1, expectedDates.length - 1) ) } @@ -196,18 +190,12 @@ export const testRecurring = function ( prev = expectedDates[i - 1] // Test after() and before() with inc=true. - assertDatesEqual(rule.after(date, true), date, 'after, inc=true') - assertDatesEqual(rule.before(date, true), date, 'before, inc=true') + assertDatesEqual(rule.after(date, true), date) + assertDatesEqual(rule.before(date, true), date) // Test after() and before() with inc=false. - next && - assertDatesEqual(rule.after(date, false), next, 'after, inc=false') - prev && - assertDatesEqual( - rule.before(date, false), - prev, - 'before, inc=false' - ) + next && assertDatesEqual(rule.after(date, false), next) + prev && assertDatesEqual(rule.before(date, false), prev) } } }