fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at feat/use-query-options 30 lines 964 B view raw
1import { describe, expect, it } from 'vitest'; 2 3import { safeRuntimeName } from '../name'; 4 5describe('safeRuntimeName', () => { 6 const scenarios = [ 7 // Digits: valid as regular char, can reprocess → leading underscore 8 { name: '3foo', output: '_3foo' }, 9 { name: '123', output: '_123' }, 10 11 // $ sign: invalid in Python as regular char → single underscore, skip reprocess 12 { name: '$schema', output: '_schema' }, 13 { name: '$foo', output: '_foo' }, 14 15 // Hyphen: first char is valid (a, f), hyphen becomes underscore in loop 16 { name: 'api-version', output: 'api_version' }, 17 { name: 'foo-bar', output: 'foo_bar' }, 18 19 // Normal cases 20 { name: 'foo', output: 'foo' }, 21 { name: '_private', output: '_private' }, 22 23 // Reserved words 24 { name: 'class', output: 'class_' }, 25 ] as const; 26 27 it.each(scenarios)('transforms $name -> $output', ({ name, output }) => { 28 expect(safeRuntimeName(name)).toEqual(output); 29 }); 30});