Skip to content

Commit e6ab017

Browse files
committed
Add polygon test
1 parent 907c95d commit e6ab017

File tree

9 files changed

+49
-6
lines changed

9 files changed

+49
-6
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- run: npm i
12+
- run: npm run build
13+
14+
typecheck:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
- run: npm i
19+
- run: npx tsc
20+
21+
test:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- run: npm i
26+
- run: npm run coverage

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
package-lock.json
3+
coverage
34
*.tgz

demo/bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/bundle.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/polys.json

Lines changed: 6 additions & 0 deletions
Large diffs are not rendered by default.

examples/polys.parquet

29.1 KB
Binary file not shown.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@rollup/plugin-node-resolve": "16.0.0",
2525
"@rollup/plugin-terser": "0.4.4",
2626
"@types/google.maps": "3.58.1",
27+
"@vitest/coverage-v8": "2.1.8",
2728
"http-server": "14.1.1",
2829
"rollup": "4.28.1",
2930
"typescript": "5.7.2",
@@ -35,6 +36,7 @@
3536
"main": "src/index.js",
3637
"scripts": {
3738
"build": "rollup -c",
39+
"coverage": "vitest run --coverage --coverage.include=src",
3840
"start": "http-server",
3941
"test": "vitest run"
4042
},

test/geoparquet.test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
import { asyncBufferFromFile } from 'hyparquet'
22
import { describe, expect, it } from 'vitest'
33
import { toGeoJson } from '../src/index.js'
4-
import expected from '../examples/example.json' with { type: 'json' }
4+
import example from '../examples/example.json' with { type: 'json' }
5+
import polys from '../examples/polys.json' with { type: 'json' }
56

67
describe('geoparquet', () => {
7-
it('should parse example geoparquet file', async () => {
8+
it('should parse example.parquet', async () => {
89
const asyncBuffer = await asyncBufferFromFile('examples/example.parquet')
910
const geojson = await toGeoJson(asyncBuffer)
10-
expect(geojson).toEqual(expected)
11+
expect(geojson).toEqual(example)
12+
})
13+
14+
it('should parse polys.parquet', async () => {
15+
const asyncBuffer = await asyncBufferFromFile('examples/polys.parquet')
16+
const geojson = await toGeoJson(asyncBuffer)
17+
expect(geojson).toEqual(polys)
1118
})
1219
})

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"module": "nodenext",
77
"noEmit": true,
88
"resolveJsonModule": true,
9+
"skipLibCheck": true,
910
"strict": true,
1011
},
11-
"include": ["src", "demo"],
12+
"include": ["src", "demo", "test"],
1213
}

0 commit comments

Comments
 (0)