Skip to content

Commit e4241ee

Browse files
committed
chore: migrate to latest version of apiClient
1 parent 017a187 commit e4241ee

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
"@japa/expect-type": "^2.0.3",
5151
"@japa/file-system": "^2.3.2",
5252
"@japa/plugin-adonisjs": "^4.0.0",
53-
"@japa/runner": "4.1.0",
53+
"@japa/runner": "4.2.0",
5454
"@japa/snapshot": "^2.0.8",
5555
"@release-it/conventional-changelog": "^10.0.0",
56-
"@swc/core": "^1.10.11",
56+
"@swc/core": "1.10.7",
5757
"@types/node": "^22.12.0",
5858
"@types/qs": "^6.9.18",
5959
"@types/supertest": "^6.0.2",

src/plugins/japa/api_client.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,27 @@ export function inertiaApiClient(app: ApplicationService): PluginFn {
119119
ApiResponse.macro(
120120
'assertInertiaProps',
121121
function (this: ApiResponse, props: Record<string, unknown>) {
122-
this.ensureHasAssert()
122+
if (!this.assert) {
123+
throw new Error(
124+
'Response assertions are not available. Make sure to install the @japa/assert plugin'
125+
)
126+
}
123127
ensureIsInertiaResponse.call(this)
124-
this.assert!.deepEqual(this.body().props, props)
128+
this.assert.deepEqual(this.body().props, props)
125129
return this
126130
}
127131
)
128132

129133
ApiResponse.macro(
130134
'assertInertiaPropsContains',
131135
function (this: ApiResponse, props: Record<string, unknown>) {
132-
this.ensureHasAssert()
136+
if (!this.assert) {
137+
throw new Error(
138+
'Response assertions are not available. Make sure to install the @japa/assert plugin'
139+
)
140+
}
133141
ensureIsInertiaResponse.call(this)
134-
this.assert!.containsSubset(this.body().props, props)
142+
this.assert.containsSubset(this.body().props, props)
135143
return this
136144
}
137145
)

0 commit comments

Comments
 (0)