@@ -29,7 +29,11 @@ test("/users/exists", async () => {
2929test ( "basic auth" , async ( ) => {
3030 let res = await GET ( "/users/me" ) ;
3131 expect ( res . status ) . toBe ( 401 ) ;
32- res = await GET ( `/users/me?token=${ MOCK_TOKEN } ` ) ;
32+ res = await GET ( "/users/me" , {
33+ headers : {
34+ Authorization : MOCK_TOKEN ,
35+ } ,
36+ } ) ;
3337 expect ( res . status ) . toBe ( 200 ) ;
3438 const json = await res . json ( ) ;
3539 expect ( json . name ) . toBe ( "田中太郎" ) ;
@@ -42,15 +46,27 @@ test("send request", async () => {
4246 res = await PUT ( "/requests/send/102" ) ;
4347 expect ( res . status ) . toBe ( 401 ) ;
4448
45- res = await GET ( `/users/pending/from-me?token=${ MOCK_TOKEN } ` ) ;
49+ res = await GET ( "/users/pending/from-me" , {
50+ headers : {
51+ Authorization : MOCK_TOKEN ,
52+ } ,
53+ } ) ;
4654 expect ( res . status ) . toBe ( 200 ) ;
4755 expect ( await res . json ( ) ) . toSatisfy ( ( s ) => s . length === 0 ) ;
4856 // starting actual request
4957
50- res = await PUT ( `/requests/send/102?token=${ MOCK_TOKEN } ` ) ;
58+ res = await PUT ( "/requests/send/102" , {
59+ headers : {
60+ Authorization : MOCK_TOKEN ,
61+ } ,
62+ } ) ;
5163 expect ( res . status ) . toBe ( 201 ) ;
5264
53- res = await GET ( `/users/pending/from-me?token=${ MOCK_TOKEN } ` ) ;
65+ res = await GET ( "/users/pending/from-me" , {
66+ headers : {
67+ Authorization : MOCK_TOKEN ,
68+ } ,
69+ } ) ;
5470 expect ( await res . json ( ) ) . toSatisfy (
5571 ( s ) => s . length === 1 && s [ 0 ] . name === "山田花子" ,
5672 ) ;
0 commit comments