Skip to content

Commit 82e4776

Browse files
committed
Add Closure test
1 parent ab1f0a7 commit 82e4776

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/MiddlewareTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ public function test_the_version_can_be_a_string()
4141
]);
4242
}
4343

44+
public function test_the_version_can_be_a_closure()
45+
{
46+
Inertia::version(function () {
47+
return md5('Inertia');
48+
});
49+
50+
$request = Request::create('/user/edit', 'GET');
51+
$request->headers->add(['X-Inertia' => 'true']);
52+
$request->headers->add(['X-Inertia-Version' => 'b19a24ee5c287f42ee1d465dab77ab37']);
53+
54+
$response = $this->makeMockResponse($request);
55+
56+
$response->assertSuccessful();
57+
$response->assertJson([
58+
'component' => 'User/Edit',
59+
]);
60+
}
61+
4462
public function test_it_will_instruct_inertia_to_reload_on_a_version_mismatch()
4563
{
4664
Inertia::version(1234);

0 commit comments

Comments
 (0)