Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Dec 26, 2024
1 parent 714d34e commit 9ebe2fe
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/core/test/diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,19 @@ test('getter only property', () => {
`)
})

function getErrorDiff(actual: unknown, expected: unknown, options?: DiffOptions) {
test('truncate large diff', () => {
const diff = getErrorDiff(Array.from({ length: 500_000 }).fill(0), 1234)
expect(diff.length).lessThan(200_000)
expect(diff.trim()).toMatch(/\.\.\.$/)
})

function getErrorDiff(actual: unknown, expected: unknown, options?: DiffOptions): string {
try {
expect(actual).toEqual(expected)
}
catch (e) {
const error = processError(e, options)
return error.diff
}
expect.unreachable()
return expect.unreachable()
}

0 comments on commit 9ebe2fe

Please sign in to comment.