8000 [Tests] Update tests for user `me` route · X-Coder264/laravel@8725cfa · GitHub
[go: up one dir, main page]

Skip to content

Commit 8725cfa

Browse files
committed
[Tests] Update tests for user me route
See laravel-json-api#100
1 parent fa2cb8c commit 8725cfa

File tree

7 files changed

+7
-8
lines changed

7 files changed

+7
-8
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"laravel/framework": "^8.30"
3535
},
3636
"require-dev": {
37-
"laravel-json-api/hashids": "^1.0.0-beta.2",
37+
"laravel-json-api/hashids": "^1.0.0-beta.3",
3838
"laravel-json-api/testing": "^1.0.0-beta.1",
3939
"orchestra/testbench": "^6.9",
4040
"phpunit/phpunit": "^9.5"

tests/dummy/app/JsonApi/V1/Comments/CommentSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CommentSchema extends Schema
4444
public function fields(): array
4545
{
4646
return [
47-
HashId::make()->alreadyHashed(),
47+
HashId::make()->alreadyHashed()->withLength(10),
4848
Str::make('content'),
4949
DateTime::make('createdAt')->sortable()->readOnly(),
5050
BelongsTo::make('post'),

tests/dummy/app/JsonApi/V1/Posts/PostSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class PostSchema extends Schema
6767
public function fields(): array
6868
{
6969
return [
70-
HashId::make()->alreadyHashed(),
70+
HashId::make()->alreadyHashed()->withLength(10),
7171
BelongsTo::make('author')->type('users')->readOnly(),
7272
HasMany::make('comments')->readOnly(),
7373
Str::make('content'),

tests/dummy/app/JsonApi/V1/Tags/TagSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class TagSchema extends Schema
4444
public function fields(): array
4545
{
4646
return [
47-
HashId::make()->alreadyHashed(),
47+
HashId::make()->alreadyHashed()->withLength(10),
4848
DateTime::make('createdAt')->sortable()->readOnly(),
4949
Str::make('name')->sortable(),
5050
BelongsToMany::make('posts')

tests/dummy/app/JsonApi/V1/Users/UserSchema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class UserSchema extends Schema
4444
public function fields(): array
4545
{
4646
return [
47-
HashId::make()->alreadyHashed(),
47+
HashId::make()->alreadyHashed()->withLength(10),
4848
DateTime::make('createdAt')->readOnly(),
4949
Str::make('name'),
5050
DateTime::make('updatedAt')->readOnly(),

tests/dummy/routes/api.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919

2020
/** Users */
2121
$server->resource('users')->only('show')->actions(function ($actions) {
22-
// we use `-me` because `me` would match the hash-id pattern
23-
$actions->get('-me', 'me');
22+
$actions->get('me');
2423
});
2524

2625
/** Videos */

tests/dummy/tests/Api/V1/Users/ReadTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testMe(): void
5252
$response = $this
5353
->actingAs($user)
5454
->jsonApi('users')
55-
->get(url('/api/v1/users/-me'));
55+
->get(url('/api/v1/users/me'));
5656

5757
$response->assertFetchedOneExact($expected);
5858
}

0 commit comments

Comments
 (0)
0