Skip to content

Commit

Permalink
fix: update RawQueryResponse response type properties (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
dankreiger authored May 23, 2023
1 parent 519d510 commit 5eb0272
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,10 @@ export type UnfilteredResponseQueryOptions = RequestOptions & {

/** @public */
export interface RawQueryResponse<R> {
q: string
query: string
ms: number
result: R
resultSourceMap: ContentSourceMap
resultSourceMap?: ContentSourceMap
}

/** @internal */
Expand Down
24 changes: 12 additions & 12 deletions test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ describe('client', async () => {
.get(`/v1/data/query/foo?query=${qs}`)
.reply(200, {
ms: 123,
q: query,
query: query,
result: [{_id: 'njgNkngskjg', rating: 5}],
})

Expand All @@ -421,13 +421,13 @@ describe('client', async () => {
.get(`/v1/data/query/foo?query=${qs}`)
.reply(200, {
ms: 123,
q: query,
query: query,
result: [{_id: 'njgNkngskjg', rating: 5}],
})

const res = await getClient().fetch(query, params, {filterResponse: false})
expect(res.ms, 'should include timing info').toBe(123)
expect(res.q, 'should include query').toBe(query)
expect(res.query, 'should include query').toBe(query)
expect(res.result.length, 'length should match').toBe(1)
expect(res.result[0].rating, 'data should match').toBe(5)
})
Expand All @@ -437,7 +437,7 @@ describe('client', async () => {
.get(`/v1/data/query/foo?query=*&tag=mycompany.syncjob`)
.reply(200, {
ms: 123,
q: '*',
query: '*',
result: [{_id: 'njgNkngskjg', rating: 5}],
})

Expand All @@ -451,7 +451,7 @@ describe('client', async () => {
.get(`/v1/data/query/foo?query=*&tag=mycompany.syncjob`)
.reply(200, {
ms: 123,
q: '*',
query: '*',
result: [{_id: 'njgNkngskjg', rating: 5}],
})

Expand All @@ -465,7 +465,7 @@ describe('client', async () => {
.get(`/v1/data/query/foo?query=*&tag=mycompany.syncjob`)
.reply(200, {
ms: 123,
q: '*',
query: '*',
result: [{_id: 'njgNkngskjg', rating: 5}],
})

Expand Down Expand Up @@ -532,7 +532,7 @@ describe('client', async () => {

nock(projectHost()).get(`/v1/data/query/foo?query=*`).delay(100).reply(200, {
ms: 123,
q: '*',
query: '*',
result: [],
})

Expand Down Expand Up @@ -1122,7 +1122,7 @@ describe('client', async () => {
.query({query, ...qParams})
.reply(200, {
ms: 123,
q: query,
query: query,
result: [{_id: 'njgNkngskjg', rating: 5}],
})

Expand All @@ -1148,7 +1148,7 @@ describe('client', async () => {
.post('/v1/data/query/foo', '*')
.reply(200, {
ms: 123,
q: query,
query: query,
result: [{_id: 'njgNkngskjg', rating: 5}],
})

Expand Down Expand Up @@ -1179,7 +1179,7 @@ describe('client', async () => {
.post('/v1/data/query/foo', '*')
.reply(200, {
ms: 123,
q: query,
query: query,
result: [{_id: 'njgNkngskjg', rating: 5}],
})

Expand All @@ -1206,7 +1206,7 @@ describe('client', async () => {
.post('/v1/data/query/foo?tag=myapp.silly-query', '*')
.reply(200, {
ms: 123,
q: query,
query: query,
result: [{_id: 'njgNkngskjg', rating: 5}],
})

Expand All @@ -1233,7 +1233,7 @@ describe('client', async () => {
.post('/v1/data/query/foo', '*')
.reply(200, {
ms: 123,
q: query,
query: query,
result: [{_id: 'njgNkngskjg', rating: 5}],
})

Expand Down

0 comments on commit 5eb0272

Please sign in to comment.