Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests #17

Merged
merged 24 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
1ec139e
feat: return encoded source ID from writer.addSource()
gmaclennan Sep 5, 2024
945372e
feat: store upstream source ids on style metadata
gmaclennan Sep 5, 2024
003a32f
chore!: adjust Reader API
gmaclennan Sep 23, 2024
01ea630
chore: improve download types
gmaclennan Sep 23, 2024
e279fe8
chore: stricter (readonly) BBox type
gmaclennan Sep 23, 2024
5831644
[WIP] add tests (+1 squashed commit)
gmaclennan Sep 23, 2024
af102cd
fix up Writer & improve type safety
gmaclennan Sep 25, 2024
a945e7f
fix Reader.getUrl for empty baseUrl string
gmaclennan Sep 25, 2024
2d98bc0
fix style metadata
gmaclennan Sep 25, 2024
dbfe151
types cleanup for reader
gmaclennan Sep 25, 2024
1b70a2e
make params optional for tileIterator
gmaclennan Sep 25, 2024
e0421bd
fix: writer should remove layers without source in SMP
gmaclennan Sep 25, 2024
fcb739a
chore: DRY template function
gmaclennan Sep 25, 2024
8295343
types: stricter style spec for SMP
gmaclennan Sep 25, 2024
7fbf967
chore: add a bunch of tests
gmaclennan Sep 25, 2024
3fd3b74
external geojson test
gmaclennan Sep 25, 2024
a5c6368
test for writing & reading sprites
gmaclennan Sep 25, 2024
78ffd81
cleanup sprite test
gmaclennan Sep 26, 2024
c489006
test multiple sprites
gmaclennan Sep 26, 2024
7379049
raster source tests
gmaclennan Sep 26, 2024
ea4ae96
remove unused method from styleDownloader
gmaclennan Sep 26, 2024
c20a205
fixup types
gmaclennan Sep 26, 2024
cddac24
update readme
gmaclennan Sep 26, 2024
24c9e71
run tests on CI
gmaclennan Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup types
gmaclennan committed Sep 26, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit c20a20512e925e4167a01c50886bca7b89084e79
10 changes: 6 additions & 4 deletions lib/types.ts
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ import type {
RasterSourceSpecification,
RasterDEMSourceSpecification,
} from '@maplibre/maplibre-gl-style-spec'
import type { GeoJSON } from 'geojson'
import type { GeoJSON, BBox } from 'geojson'
import type { Readable } from 'stream'
import type { Except, SetRequired, Simplify } from 'type-fest'

@@ -55,9 +55,11 @@ export type SMPSource = TransformSMPInputSource<SupportedInlinedSource>
export type SMPStyle = TransformSMPStyle<StyleSpecification>

export type TransformSMPInputSource<T extends SupportedInlinedSource> =
T extends RasterSourceSpecification | VectorSourceSpecification
? SetRequired<T, 'bounds' | 'minzoom' | 'maxzoom'>
: T
T extends GeoJSONSourceSpecification
? T & { data: { bbox: BBox } }
: T extends RasterSourceSpecification | VectorSourceSpecification
? SetRequired<T, 'bounds' | 'minzoom' | 'maxzoom'>
: T

type TransformSMPStyle<T extends StyleSpecification> = Omit<T, 'sources'> & {
metadata: {
2 changes: 1 addition & 1 deletion test/download-write-read.js
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ test('Everything written can be read', async (t) => {
const smpFilePath = tempFile(t)
const smpReadStream = download({
styleUrl: TEST_MAP_STYLE,
bbox: TEST_MAP_AREA,
bbox: [...TEST_MAP_AREA],
maxzoom: 10,
})
await pipeline(smpReadStream, fs.createWriteStream(smpFilePath))