// The dev channel is defined in one place and read in another: the build // script appends the suffix, the popup reads it back off the manifest. They // cannot import each other (one is plain node, the other is bundled into the // extension), so the test is what keeps the two copies the same string. import { describe, expect, it } from 'vitest' // @ts-expect-error plain-node build script, no type declarations import { DEV_NAME_SUFFIX as BUILD_SUFFIX, devManifest } from '../../scripts/dev-channel.mjs' import { DEV_NAME_SUFFIX, isDevChannel } from './channel' describe('isDevChannel', () => { it('uses the same suffix the build script appends', () => { expect(DEV_NAME_SUFFIX).toBe(BUILD_SUFFIX) }) it('recognizes a name the dev build produced', () => { expect(isDevChannel(devManifest({ name: 'substandard' }).name)).toBe(true) }) it('says no for the release name', () => { expect(isDevChannel('substandard')).toBe(false) }) // The suffix ends the name; a publication called "substandard (dev) reader" // is not this build. it('does not match the suffix anywhere but the end', () => { expect(isDevChannel('substandard (dev) something')).toBe(false) }) })