|
1 | 1 | import { Elysia, t } from 'elysia' |
2 | 2 | import { createEdenTQ, createEdenTQUtils } from '../src' |
3 | 3 | import { QueryClient } from '@tanstack/query-core' |
4 | | -import { describe, expect, it, beforeAll, afterAll, mock, test } from 'bun:test' |
| 4 | +import { describe, expect, it, mock, test } from 'bun:test' |
5 | 5 |
|
6 | 6 | const posts = Array.from({ length: 50 }, (_, i) => ({ |
7 | 7 | id: `post-${i + 1}`, |
@@ -53,21 +53,11 @@ const app = new Elysia() |
53 | 53 | query: t.Object({ |
54 | 54 | page: t.Optional(t.String()) |
55 | 55 | }) |
56 | | - }) |
57 | | - |
58 | | -let server: ReturnType<typeof app.listen> |
59 | | - |
60 | | -beforeAll(() => { |
61 | | - server = app.listen(3459) |
62 | 56 | }) |
63 | 57 |
|
64 | | -afterAll(() => { |
65 | | - server.stop() |
66 | | -}) |
| 58 | +const eden = createEdenTQ<typeof app>(app) |
67 | 59 |
|
68 | 60 | describe('Infinite Query', () => { |
69 | | - const eden = createEdenTQ<typeof app>('http://localhost:3459') |
70 | | - |
71 | 61 | it('generates infiniteQueryOptions with cursor pagination', async () => { |
72 | 62 | const options = eden.posts.get.infiniteQueryOptions( |
73 | 63 | { query: { limit: '5' } }, |
@@ -187,8 +177,6 @@ describe('Infinite Query', () => { |
187 | 177 | }) |
188 | 178 |
|
189 | 179 | describe('EdenTQ Utils', () => { |
190 | | - const eden = createEdenTQ<typeof app>('http://localhost:3459') |
191 | | - |
192 | 180 | it('creates utils with bound QueryClient', () => { |
193 | 181 | const queryClient = new QueryClient() |
194 | 182 | const utils = createEdenTQUtils(eden, queryClient) |
@@ -267,8 +255,6 @@ describe('EdenTQ Utils', () => { |
267 | 255 | }) |
268 | 256 |
|
269 | 257 | describe('Prefetch and Cache helpers on EdenTQ', () => { |
270 | | - const eden = createEdenTQ<typeof app>('http://localhost:3459') |
271 | | - |
272 | 258 | it('prefetch works directly on eden', async () => { |
273 | 259 | const queryClient = new QueryClient() |
274 | 260 |
|
@@ -302,8 +288,6 @@ describe('Prefetch and Cache helpers on EdenTQ', () => { |
302 | 288 | }) |
303 | 289 |
|
304 | 290 | describe('Query Options extensions', () => { |
305 | | - const eden = createEdenTQ<typeof app>('http://localhost:3459') |
306 | | - |
307 | 291 | it('queryOptions accepts extended options', () => { |
308 | 292 | const options = eden.get.queryOptions({}, { |
309 | 293 | staleTime: 1000, |
|
0 commit comments