Skip to content

Commit

Permalink
feat: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoreni committed Oct 25, 2024
1 parent 87eceb8 commit 0df61d6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions test/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -654,3 +654,36 @@ expectType<typeof mercurius.ErrorWithProps>(ErrorWithProps)
expectType<typeof mercurius.defaultErrorFormatter>(defaultErrorFormatter)
expectType<typeof mercurius.persistedQueryDefaults>(persistedQueryDefaults)
expectType<typeof mercurius.withFilter>(withFilter)

app.register(mercurius, {
schema,
resolvers,
persistedQueryProvider: {
...persistedQueryDefaults.automatic(),
getQueryFromHash: () => {
return Promise.resolve('foo')
},
}
})

app.register(mercurius, {
schema,
resolvers,
persistedQueryProvider: {
...persistedQueryDefaults.automatic(),
getQueryFromHash: () => {
return Promise.resolve(undefined)
},
}
})

expectError(app.register(mercurius, {
schema,
resolvers,
persistedQueryProvider: {
...persistedQueryDefaults.automatic(),
getQueryFromHash: () => {
return Promise.resolve(false)
},
}
}))

0 comments on commit 0df61d6

Please sign in to comment.