Skip to content

Commit 9bfde6c

Browse files
committed
fix types
1 parent 3cb159a commit 9bfde6c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/utils/test/rowCache.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import { describe, expect, it, vi } from 'vitest'
2-
import { Row, awaitRows } from '../src/dataframe.js'
2+
import { AsyncRow, awaitRows } from '../src/dataframe.js'
33
import { rowCache } from '../src/rowCache.js'
44

55
// Mock DataFrame
66
function makeDf() {
77
return {
88
header: ['id'],
99
numRows: 10,
10-
rows: vi.fn((start: number, end: number): Row[] => {
10+
rows: vi.fn((start: number, end: number): AsyncRow[] => {
1111
return new Array(end - start).fill(null)
12-
.map((_, index) => ({ id: start + index }))
12+
.map((_, index) => ({ id: Promise.resolve(start + index) }))
1313
}),
1414
}
1515
}
@@ -45,10 +45,10 @@ describe('rowCache', () => {
4545
const dfCached = rowCache(df)
4646

4747
// Cache first block
48-
dfCached.rows(0, 3)
48+
await dfCached.rows(0, 3)
4949
expect(df.rows).toHaveBeenCalledTimes(1)
5050
// Cache adjacent block
51-
dfCached.rows(3, 6)
51+
await dfCached.rows(3, 6)
5252
expect(df.rows).toHaveBeenCalledTimes(2)
5353
// Fetch combined block
5454
const adjacentRows = await awaitRows(dfCached.rows(0, 6))
@@ -64,9 +64,9 @@ describe('rowCache', () => {
6464
const dfCached = rowCache(df)
6565

6666
// Cache first block
67-
dfCached.rows(0, 2)
67+
await dfCached.rows(0, 2)
6868
// Cache second block
69-
dfCached.rows(4, 6)
69+
await dfCached.rows(4, 6)
7070
// Fetch combined block
7171
const gapRows = await awaitRows(dfCached.rows(0, 6))
7272
expect(gapRows).toEqual([
@@ -81,7 +81,7 @@ describe('rowCache', () => {
8181
const dfCached = rowCache(df)
8282

8383
// Cache first block
84-
dfCached.rows(6, 9)
84+
await dfCached.rows(6, 9)
8585

8686
// Fetch overlapping block
8787
const overlappingRows = await awaitRows(dfCached.rows(8, 11))

0 commit comments

Comments
 (0)