Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,22 @@ await test('createApp', async (t) => {
assert.deepEqual(data, [{ id: '1', title: 'foo' }])
})

await t.test('invalid _where falls back to query params', async () => {
const response = await fetch(`http://localhost:${port}/posts?title=foo&_where={invalid}`
)
assert.equal(response.status, 200)
const data = await response.json()
assert.deepEqual(data, [{ id: '1', title: 'foo' }])
})

await t.test('invalid _where returns all data when no query params', async () => {
const response = await fetch(`http://localhost:${port}/posts?_where={invalid}`
)
assert.equal(response.status, 200)
const data = await response.json()
assert.deepEqual(data, [{ id: '1', title: 'foo' }])
})

await t.test('POST /posts with array body returns 400', async () => {
const response = await fetch(`http://localhost:${port}/posts`, {
method: 'POST',
Expand Down