Skip to content

Commit

Permalink
update tests after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
bjoerge committed Sep 19, 2024
1 parent 842f240 commit e079275
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 25 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
"typescript": "5.6.2",
"vite": "^4.5.3",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.3.1",
"yargs": "^17.3.0"
},
"optionalDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions packages/@sanity/migrate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@
"@repo/package.config": "workspace:*",
"@types/arrify": "^2.0.1",
"@types/debug": "^4.1.12",
"rimraf": "^3.0.2",
"vitest": "^1.3.1"
"rimraf": "^3.0.2"
},
"engines": {
"node": ">=18"
Expand Down
32 changes: 19 additions & 13 deletions packages/@sanity/migrate/src/fetch-utils/__test__/assert2xx.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {expect, test} from '@jest/globals'
import {expect, test} from 'vitest'

import {assert2xx} from '../fetchStream'

Expand All @@ -25,10 +25,12 @@ test('server responds with 4xx and error response', () => {
message: 'More details',
}),
}
expect(assert2xx(mockResponse as unknown as Response)).rejects.toThrowError({
statusCode: 400,
message: 'Error message: More details',
})
expect(assert2xx(mockResponse as unknown as Response)).rejects.toThrowError(
expect.objectContaining({
statusCode: 400,
message: 'Error message: More details',
}),
)
})

test('server responds with 5xx and no json response', () => {
Expand All @@ -37,10 +39,12 @@ test('server responds with 5xx and no json response', () => {
statusText: 'Internal Server Error',
json: () => Promise.reject(new Error('Failed to parse JSON')),
}
expect(assert2xx(mockResponse as unknown as Response)).rejects.toThrowError({
statusCode: 500,
message: 'HTTP Error 500: Internal Server Error',
})
expect(assert2xx(mockResponse as unknown as Response)).rejects.toThrowError(
expect.objectContaining({
statusCode: 500,
message: 'HTTP Error 500: Internal Server Error',
}),
)
})

test('server responds with 5xx and json response', () => {
Expand All @@ -56,8 +60,10 @@ test('server responds with 5xx and json response', () => {
status: 500,
}),
}
expect(assert2xx(mockResponse as unknown as Response)).rejects.toThrowError({
statusCode: 500,
message: 'validationError: Document is not of valid type',
})
expect(assert2xx(mockResponse as unknown as Response)).rejects.toThrowError(
expect.objectContaining({
statusCode: 500,
message: 'validationError: Document is not of valid type',
}),
)
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {expect, test} from '@jest/globals'
import {expect, test} from 'vitest'

import {decodeText} from '../decodeText'
import {toArray} from '../toArray'
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e079275

Please sign in to comment.