You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importElysia,{t}from"elysia";import{treaty}from"@elysiajs/eden";import{describe,expect,it,beforeAll,afterAll}from"bun:test";constapp=newElysia().get("/",()=>newDate("2021-01-01"),{response: {200: t.Transform(t.Date()).Decode((value)=>(valueinstanceofDate ? value.toISOString() : value)).Encode((value)=>newDate(value)),},});constapi=treaty<typeofapp>("http://localhost:3012");describe("dateTimeSchema",()=>{beforeAll(()=>app.listen(3012));afterAll(()=>app.stop());it("should encode the response correctly",async()=>{const{ data, status }=awaitapi.index.get();expect(status).toBe(200);expect(data).not.toBeEmpty();// @ts-expect-error data should be a date but it isn't. data comes as an ArrayBufferexpect(newTextDecoder().decode(data)).toBe("Fri Jan 01 2021 00:00:00 GMT+0000 (Coordinated Universal Time)");expect(datainstanceofDate).toBeTrue();});});
What is the expected behavior?
The tests to pass.
What do you see instead?
Test fails
Additional information
Transform types works well for endpoint parameters. For example, this helper converts a value from query and correctly check types:
Reposting from elysiajs/elysia#629 as I think it was the wrong place.
What version of Eden is running?
1.0.11
What platform is your computer?
Darwin 23.4.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
The tests to pass.
What do you see instead?
Test fails
Additional information
Transform types works well for endpoint parameters. For example, this helper converts a value from query and correctly check types:
The text was updated successfully, but these errors were encountered: