Skip to content

Commit

Permalink
[test] use property matchers for dynamic snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhyde committed Apr 13, 2023
1 parent c493ab5 commit 93447b3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
16 changes: 8 additions & 8 deletions source/airports/__snapshots__/integration.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6295,19 +6295,19 @@ exports[`Airports > getClosest > When asked for the closest airport
{
"aliases": [],
"city": {
"code": "DUBLIN",
"name": "Dublin",
"code": Any<String>,
"name": Any<String>,
},
"code": "DUB",
"code": Any<String>,
"coordinates": {
"latitude": 53.4213,
"longitude": -6.27007,
"latitude": Any<Number>,
"longitude": Any<Number>,
},
"country": {
"code": "ie",
"name": "Ireland",
"code": Any<String>,
"name": Any<String>,
},
"name": "Dublin",
"name": Any<String>,
}
`;
Expand Down
20 changes: 19 additions & 1 deletion source/airports/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,25 @@ describe('Airports', () => {
expect.assertions(1)

const data = await airports.getClosest()
expect(data).toMatchSnapshot()
expect(data).toMatchSnapshot({
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
aliases: [],
city: {
code: expect.any(String),
name: expect.any(String)
},
code: expect.any(String),
coordinates: {
latitude: expect.any(Number),
longitude: expect.any(Number)
},
country: {
code: expect.any(String),
name: expect.any(String)
},
name: expect.any(String)
/* eslint-enable @typescript-eslint/no-unsafe-assignment */
})
})
})

Expand Down

0 comments on commit 93447b3

Please sign in to comment.