chore: scaffold turbo monorepo with hono api and react admin web

This commit is contained in:
Jose Selesan
2026-10-15 15:24:34 -03:00
commit 2b1d2152c4
89 changed files with 4996 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import { describe, expect, it } from 'vitest'
import { Failure, Ok, problem, problemTypes } from '../src/index'
describe('Result', () => {
it('wraps success values', () => {
expect(Ok({ id: '1' })).toEqual({ ok: true, value: { id: '1' } })
})
it('wraps failures', () => {
expect(Failure('boom')).toEqual({ ok: false, error: 'boom' })
})
})
describe('problem', () => {
it('defaults type to about:blank and strips undefined members', () => {
expect(problem({ title: 'Not Found', status: 404 })).toEqual({
type: 'about:blank',
title: 'Not Found',
status: 404,
})
})
it('accepts a custom type and detail', () => {
expect(
problem({
type: problemTypes.validation,
title: 'Validation failed',
status: 422,
detail: 'name is required',
}),
).toMatchObject({ status: 422, type: problemTypes.validation })
})
})