Skip to content

Commit

Permalink
test: rename demo response typ
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Oct 24, 2023
1 parent 537cc55 commit 25505a7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createClient } from '../src'
import type { ApiBuilder } from '../src'

// Test TypeScript support
interface GenericGetResponse {
interface ApiGETResponse {
foo: string
}

Expand Down Expand Up @@ -94,23 +94,23 @@ describe('unrested', () => {
})

it('bracket syntax for path segment', async () => {
const response = await client.foo['1'].get<GenericGetResponse>()
const response = await client.foo['1'].get<ApiGETResponse>()
expect(response).to.deep.equal({ foo: '1' })
})

it('chain syntax for path segment', async () => {
const response = await client.foo(1).get<GenericGetResponse>()
const response = await client.foo(1).get<ApiGETResponse>()
expect(response).to.deep.equal({ foo: '1' })
})

it('multiple path segments', async () => {
const response = await client('foo', '1').get<GenericGetResponse>()
const response = await client('foo', '1').get<ApiGETResponse>()
expect(response).to.deep.equal({ foo: '1' })
})

it('invalid api endpoint', () => {
expect(async () => {
await client.baz.get<GenericGetResponse>()
await client.baz.get<ApiGETResponse>()
}).rejects.toThrow(/404/)
})
})

0 comments on commit 25505a7

Please sign in to comment.