Skip to content

Commit

Permalink
remove chai & mocha
Browse files Browse the repository at this point in the history
  • Loading branch information
davidgoli committed Nov 10, 2023
1 parent ce42dd0 commit 603fcd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 24 deletions.
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
28 changes: 8 additions & 20 deletions test/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -171,8 +167,7 @@ export const testRecurring = function (
expectedDates[expectedDates.length - 1],
true
),
expectedDates,
'between, inc=true'
expectedDates
)

assertDatesEqual(
Expand All @@ -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)
)
}

Expand All @@ -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)
}
}
}
Expand Down

0 comments on commit 603fcd4

Please sign in to comment.