Skip to content

Wrong types for PaginationResult #16

Closed
@boar-is

Description

@boar-is

From Discord

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions