Skip to content

Commit

Permalink
🔧 fix: null schema
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Apr 5, 2024
1 parent 0b2b04d commit a288a29
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "elysia",
"description": "Ergonomic Framework for Human",
"version": "1.0.11",
"version": "1.0.12",
"author": {
"name": "saltyAom",
"url": "https://github.com/SaltyAom",
Expand Down
39 changes: 39 additions & 0 deletions test/validator/response.test.ts
Expand Up @@ -333,4 +333,43 @@ describe('Response Validator', () => {
])
})
})

it('return void with schema', async () => {
const app = new Elysia().get('/', () => undefined, {
response: t.Union([
t.Void(),
t.Object({
name: t.String()
})
])
})
})

it('return null with status based schema', async () => {
const app = new Elysia().get('/', () => undefined, {
response: {
200: t.Union([
t.Void(),
t.Object({
name: t.String()
})
]),
418: t.String()
}
})
})

it('return static undefined with status based schema', async () => {
const app = new Elysia().get('/', undefined, {
response: {
200: t.Union([
t.Void(),
t.Object({
name: t.String()
})
]),
418: t.String()
}
})
})
})

0 comments on commit a288a29

Please sign in to comment.