Skip to content

Commit

Permalink
test: more test
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Oct 7, 2024
1 parent b9d9204 commit 898ce93
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
22 changes: 22 additions & 0 deletions test/core/test/__snapshots__/jest-expect.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,28 @@ exports[`error equality 6`] = `
}
`;
exports[`error equality 7`] = `
{
"actual": "[AggregateError: outer]",
"diff": "- Expected
+ Received
AggregateError {
"message": "outer",
"cause": "x",
"errors": Array [
Error {
"message": "inner",
- "cause": "y",
+ "cause": "x",
},
],
}",
"expected": "[AggregateError: outer]",
"message": "expected AggregateError: outer { …(2) } to deeply equal AggregateError: outer { …(2) }",
}
`;
exports[`toHaveBeenNthCalledWith error 1`] = `
{
"actual": "Array [
Expand Down
15 changes: 14 additions & 1 deletion test/core/test/jest-expect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,20 @@ it('error equality', () => {
snapshotError(() => expect(e1).toEqual(e2))
}

// TODO: AggregateError
{
// AggregateError (pass)
const e1 = new AggregateError([new Error('inner')], 'outer', { cause: 'x' })
const e2 = new AggregateError([new Error('inner')], 'outer', { cause: 'x' })
expect(e1).toEqual(e2)
}

{
// AggregateError (fail)
const e1 = new AggregateError([new Error('inner', { cause: 'x' })], 'outer', { cause: 'x' })
const e2 = new AggregateError([new Error('inner', { cause: 'y' })], 'outer', { cause: 'x' })
snapshotError(() => expect(e1).toEqual(e2))
}

// TODO: cyclic
})

Expand Down

0 comments on commit 898ce93

Please sign in to comment.