mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 03:20:12 +08:00
feat: parse quest using zod, basic
This commit is contained in:
1 parent
963655c1f7
commit
ed4d04b658
22 files changed
+390
-95
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import { describe, it, expect } from '@jest/globals'
|
||||
import { responseSchema } from '../src/quest/response.js'
|
||||
|
||||
describe('parsing response', () => {
|
||||
it('should parse valid response', () => {
|
||||
const response = {
|
||||
type: 'narrative',
|
||||
content: 'This is a response content',
|
||||
}
|
||||
const result = responseSchema.safeParse(response)
|
||||
expect(result.error).toBeUndefined()
|
||||
})
|
||||
|
||||
it('should fail to parse invalid response', () => {
|
||||
const response = {
|
||||
type: 'dialogue',
|
||||
content: 'This is a response content',
|
||||
}
|
||||
const result = responseSchema.safeParse(response)
|
||||
expect(result.error).toBeUndefined()
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user