Skip to content

Commit 1c2ce65

Browse files
committed
test(stork): cover node 22 runtime detection
Add focused regression tests for the environment helper and Stork binary target selection so the Ubuntu 24 and Apple Silicon path stays protected.
1 parent 9e48862 commit 1c2ce65

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

test/prebuild/environment.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { describe, expect, it } from 'vitest'
2+
3+
import {
4+
isBrowserContext,
5+
isDarwin,
6+
isLinux
7+
} from '~/helpers/environment.js'
8+
9+
describe( 'environment helpers', () => {
10+
it( 'does not treat Node 22 navigator as a browser runtime', () => {
11+
expect( isBrowserContext() ).toBe( false )
12+
})
13+
14+
it( 'detects darwin directly from process.platform', () => {
15+
expect( isDarwin() ).toBe( process.platform === 'darwin' )
16+
})
17+
18+
it( 'detects linux-like runtimes directly from process.platform', () => {
19+
expect( isLinux() ).toBe([
20+
'linux',
21+
'openbsd'
22+
].includes( process.platform ) )
23+
})
24+
})
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import { describe, expect, it } from 'vitest'
2+
3+
import {
4+
getStorkExecutableTarget,
5+
getStorkExecutableDownloadUrl
6+
} from '~/helpers/stork/executable.js'
7+
8+
describe( 'stork executable selection', () => {
9+
it( 'uses the Ubuntu 22.04 binary for Linux builds', () => {
10+
expect( getStorkExecutableTarget({
11+
platform: 'linux',
12+
arch: 'x64'
13+
}) ).toBe( 'stork-ubuntu-22-04' )
14+
})
15+
16+
it( 'uses the Apple Silicon macOS binary on arm64 Macs', () => {
17+
expect( getStorkExecutableTarget({
18+
platform: 'darwin',
19+
arch: 'arm64'
20+
}) ).toBe( 'stork-macos-13-arm' )
21+
})
22+
23+
it( 'builds the download URL from the selected target', () => {
24+
expect( getStorkExecutableDownloadUrl({
25+
platform: 'linux',
26+
arch: 'x64'
27+
}) ).toContain( '/stork-ubuntu-22-04' )
28+
})
29+
})

0 commit comments

Comments
 (0)