Skip to content

Commit d145bcc

Browse files
authored
fix bug when merging two ranges (#23)
* fix bug when merging two ranges * add test to ci and update actions
1 parent a110142 commit d145bcc

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,27 @@ jobs:
88
lint:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v6
1212
- run: npm i
1313
- run: npm run lint
1414

1515
typecheck:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
1919
- run: npm i
2020
- run: npm run typecheck
2121

2222
buildcheck:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v4
25+
- uses: actions/checkout@v6
2626
- run: npm i
2727
- run: npm run build
28+
29+
test:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v6
33+
- run: npm i
34+
- run: npm run test

.github/workflows/deploy_pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ jobs:
1111
runs-on: ubuntu-latest
1212
steps:
1313
- name: Checkout the repository
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@v6
1515
- name: Build
1616
run: |
1717
npm i
1818
npm run build
1919
- name: Upload static files as artifact
2020
id: deployment
21-
uses: actions/upload-pages-artifact@v3
21+
uses: actions/upload-pages-artifact@v4
2222
with:
2323
path: dist/
2424

src/cache.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ export class CSVRange {
158158
throw new Error('Cannot merge ranges: not contiguous')
159159
}
160160
this.#byteCount += followingRange.byteCount
161+
this.#rowByteCount += followingRange.rowByteCount
161162
for (const row of followingRange.rows) {
162163
this.#rows.push(row)
163164
}

test/cache.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ describe('CSVRange', () => {
9999
byteOffset: 10,
100100
byteCount: 10,
101101
})
102+
expect(range1.rowByteCount).toBe(10)
102103

103104
const range2 = new CSVRange({ firstByte: 20, firstRow: 2 })
104105
range2.append({
@@ -110,12 +111,14 @@ describe('CSVRange', () => {
110111
byteOffset: 30,
111112
byteCount: 10,
112113
})
114+
expect(range2.rowByteCount).toBe(10)
113115

114116
range1.merge(range2)
115117

116118
expect(range1.rowCount).toBe(2)
117119
expect(range1.byteCount).toBe(40)
118120
expect(range1.firstRow).toBe(0)
121+
expect(range1.rowByteCount).toBe(20)
119122
expect(range1.next).toStrictEqual({ firstByte: 40, row: 2 })
120123
expect(range1.rows).toEqual([['b', 'c', 'd'], ['e', 'f', 'g']])
121124
expect(range1.getCells({ row: 0 })).toEqual(['b', 'c', 'd'])

0 commit comments

Comments
 (0)