mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
The Netlify validation job imports site listings before generated static device JSON exists in a clean checkout, so keep the small device table in tracked source and use it as the route fallback. Constraint: static/device-list.json is ignored generated output and is absent in GitHub-hosted clean runners Rejected: Force-add static/device-list.json | keeps generated output under source control Confidence: high Scope-risk: narrow Directive: Keep disabled device rows in the fallback source but filter them from routable listings Tested: pnpm run with-env vitest ./test/prebuild/site-listings.test.js Tested: pnpm netlify-build reached Astro build after passing prebuild tests Not-tested: Full local netlify-build completion blocked by unrelated uncommitted scanner worker build failure
29 lines
1,002 B
JavaScript
29 lines
1,002 B
JavaScript
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
getDeviceListingBySlug,
|
|
getVideoListingBySlug
|
|
} from '~/helpers/site-listings.js'
|
|
|
|
describe( 'site listing fallbacks', () => {
|
|
it( 'loads known devices from the bundled device list', () => {
|
|
expect( getDeviceListingBySlug( '2023-m3-imac' ) ).toMatchObject({
|
|
name: '2023 M3 iMac',
|
|
endpoint: '/device/2023-m3-imac'
|
|
})
|
|
})
|
|
|
|
it( 'rebuilds known tv listings from the bundled YouTube source', async () => {
|
|
await expect(
|
|
getVideoListingBySlug( 'install-instagram-app-on-m1-macbook-air-apple-silicon-tutorial-i-vfbmworal6i' )
|
|
).resolves.toMatchObject({
|
|
endpoint: '/tv/install-instagram-app-on-m1-macbook-air-apple-silicon-tutorial-i-vfbmworal6i'
|
|
})
|
|
})
|
|
|
|
it( 'returns null for missing tv slugs', async () => {
|
|
await expect(
|
|
getVideoListingBySlug( 'apple-silicon-gaming-is-here' )
|
|
).resolves.toBeNull()
|
|
})
|
|
})
|