github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/packages/pyroscope-models/src/spyName.spec.ts (about) 1 import { SpyNameSchema, AllSpyNames } from './spyName'; 2 3 describe('SpyName', () => { 4 it('defaults to "unknown" when absent', () => { 5 expect(SpyNameSchema.parse('')).toBe('unknown'); 6 }); 7 8 it('defaults to "unknown" when value is not in the allowlist', () => { 9 expect(SpyNameSchema.parse('other')).toBe('unknown'); 10 }); 11 12 test.each(AllSpyNames.map((a) => [a, a]))( 13 'parse("%s") should return "%s"', 14 (spyName) => { 15 expect(SpyNameSchema.parse(spyName)).toBe(spyName); 16 } 17 ); 18 });