Something went wrong. Try again.
Browser extension: detect and subscribe to standard.site publications on ATProto
Something went wrong. Try again.
1.2 kB · 29 lines
TypeScript
123456789101112131415161718192021222324252627282930// 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 declarationsimport { 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) })})