mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
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.
This commit is contained in:
parent
9e48862a5f
commit
1c2ce65f7d
2 changed files with 53 additions and 0 deletions
24
test/prebuild/environment.test.js
Normal file
24
test/prebuild/environment.test.js
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
|
import {
|
||||||
|
isBrowserContext,
|
||||||
|
isDarwin,
|
||||||
|
isLinux
|
||||||
|
} from '~/helpers/environment.js'
|
||||||
|
|
||||||
|
describe( 'environment helpers', () => {
|
||||||
|
it( 'does not treat Node 22 navigator as a browser runtime', () => {
|
||||||
|
expect( isBrowserContext() ).toBe( false )
|
||||||
|
})
|
||||||
|
|
||||||
|
it( 'detects darwin directly from process.platform', () => {
|
||||||
|
expect( isDarwin() ).toBe( process.platform === 'darwin' )
|
||||||
|
})
|
||||||
|
|
||||||
|
it( 'detects linux-like runtimes directly from process.platform', () => {
|
||||||
|
expect( isLinux() ).toBe([
|
||||||
|
'linux',
|
||||||
|
'openbsd'
|
||||||
|
].includes( process.platform ) )
|
||||||
|
})
|
||||||
|
})
|
||||||
29
test/prebuild/stork-executable.test.js
Normal file
29
test/prebuild/stork-executable.test.js
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
import { describe, expect, it } from 'vitest'
|
||||||
|
|
||||||
|
import {
|
||||||
|
getStorkExecutableTarget,
|
||||||
|
getStorkExecutableDownloadUrl
|
||||||
|
} from '~/helpers/stork/executable.js'
|
||||||
|
|
||||||
|
describe( 'stork executable selection', () => {
|
||||||
|
it( 'uses the Ubuntu 22.04 binary for Linux builds', () => {
|
||||||
|
expect( getStorkExecutableTarget({
|
||||||
|
platform: 'linux',
|
||||||
|
arch: 'x64'
|
||||||
|
}) ).toBe( 'stork-ubuntu-22-04' )
|
||||||
|
})
|
||||||
|
|
||||||
|
it( 'uses the Apple Silicon macOS binary on arm64 Macs', () => {
|
||||||
|
expect( getStorkExecutableTarget({
|
||||||
|
platform: 'darwin',
|
||||||
|
arch: 'arm64'
|
||||||
|
}) ).toBe( 'stork-macos-13-arm' )
|
||||||
|
})
|
||||||
|
|
||||||
|
it( 'builds the download URL from the selected target', () => {
|
||||||
|
expect( getStorkExecutableDownloadUrl({
|
||||||
|
platform: 'linux',
|
||||||
|
arch: 'x64'
|
||||||
|
}) ).toContain( '/stork-ubuntu-22-04' )
|
||||||
|
})
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue