DelveroffD
Convex Community2y ago
9 replies
Delveroff

Wrong types for `PaginationResult`

continueCursor should be string | null, now it's just string

import type { PaginationResult } from 'convex/server'
import { describe, expect, it } from 'vitest'
import { convexTester } from '~/convex/utils/setup.testing'
import { api } from '../_generated/api'
import type { Doc, Id } from '../_generated/dataModel'

describe.concurrent.only('posts', () => {
  it('should return empty collection on no data', async () => {
    const t = convexTester()
    expect(
      await t.query(api.user.posts.default, {
        userId: '1;users' as Id<'users'>,
        cursor: null,
      }),
    ).toEqual({
      // @ts-expect-error the tests passes, therefore, the value is null
      continueCursor: null,
      isDone: true,
      page: [],
    } satisfies PaginationResult<Doc<'posts'>>)
  })
})


Maybe it's just testing behavior. If it is, then there's a bug in convex-test.
Was this page helpful?