11import { Hono } from "hono" ;
22import { Stl , UnauthorizedError , z } from "stainless" ;
3- import { describe , expect , test } from "vitest" ;
4- import { stlApi } from "./honoPlugin" ;
3+ import { stlApi } from "../honoPlugin" ;
54
65const stl = new Stl ( { plugins : { } } ) ;
76
@@ -63,9 +62,7 @@ describe("basic routing", () => {
6362 test ( "list posts" , async ( ) => {
6463 const response = await app . request ( "/api/posts" ) ;
6564 expect ( response ) . toHaveProperty ( "status" , 200 ) ;
66- expect ( await response . json ( ) ) . toMatchInlineSnapshot ( `
67- []
68- ` ) ;
65+ expect ( await response . json ( ) ) . toMatchInlineSnapshot ( "[]" ) ;
6966 } ) ;
7067
7168 test ( "retrieve posts" , async ( ) => {
@@ -85,11 +82,19 @@ describe("basic routing", () => {
8582 expect ( response ) . toHaveProperty ( "status" , 405 ) ;
8683 expect ( await response . json ( ) ) . toMatchInlineSnapshot ( `
8784 {
88- "message": "No handler for PUT; only GET, POST.",
85+ "message": "No handler for PUT; only GET, HEAD, POST.",
8986 }
9087 ` ) ;
9188 } ) ;
9289
90+ test ( "head posts" , async ( ) => {
91+ const response = await app . request ( "/api/posts/5" , {
92+ method : "HEAD" ,
93+ } ) ;
94+ expect ( response ) . toHaveProperty ( "status" , 200 ) ;
95+ expect ( await response . text ( ) ) . toBe ( "" ) ;
96+ } ) ;
97+
9398 test ( "update posts" , async ( ) => {
9499 const response = await app . request ( "/api/posts/5" , {
95100 method : "POST" ,
@@ -159,7 +164,7 @@ describe("basic routing", () => {
159164 "received": "undefined",
160165 },
161166 ],
162- "message": "Validation error: Required at "<body>.content"",
167+ "message": "Required at "<body>.content"",
163168 }
164169 ` ) ;
165170 } ) ;
0 commit comments