github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/packages/pyroscope-models/src/profile.spec.ts (about) 1 import { MetadataSchema, FlamebearerSchema } from './profile'; 2 3 describe('Profile', () => { 4 describe('FlamebearerSchema', () => { 5 describe('Names', () => { 6 it('defaults to "unknown" when name is empty', () => { 7 const fb = { 8 names: ['', ''], 9 levels: [], 10 numTicks: 100, 11 maxSelf: 100, 12 }; 13 expect(FlamebearerSchema.parse(fb)).toStrictEqual({ 14 names: ['unknown', 'unknown'], 15 levels: [], 16 numTicks: 100, 17 maxSelf: 100, 18 }); 19 }); 20 21 it('uses correct name when not empty', () => { 22 const fb = { 23 names: ['myname', 'myname2'], 24 levels: [], 25 numTicks: 100, 26 maxSelf: 100, 27 }; 28 expect(FlamebearerSchema.parse(fb)).toStrictEqual(fb); 29 }); 30 }); 31 }); 32 });