UNPKG

@api3/contracts

Version:

Contracts through which API3 services are delivered

38 lines 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const strings_1 = require("./strings"); describe(strings_1.toUpperSnakeCase.name, () => { it('converts simple words', () => { const result = (0, strings_1.toUpperSnakeCase)('hello world'); expect(result).toBe('HELLO_WORLD'); }); it('keeps numbers in the string', () => { const result = (0, strings_1.toUpperSnakeCase)('hello world 4'); expect(result).toBe('HELLO_WORLD_4'); }); it('trims leading and trailing whitespaces', () => { const result = (0, strings_1.toUpperSnakeCase)(' hello world '); expect(result).toBe('HELLO_WORLD'); }); it('converts special characters to underscores', () => { const result = (0, strings_1.toUpperSnakeCase)('hello,world!'); expect(result).toBe('HELLO_WORLD'); }); it('converts special characters and spaces to underscores', () => { const result = (0, strings_1.toUpperSnakeCase)('hello, world!'); expect(result).toBe('HELLO_WORLD'); }); it('converts multiple spaces to single underscores', () => { const result = (0, strings_1.toUpperSnakeCase)('hello world'); expect(result).toBe('HELLO_WORLD'); }); it('returns an empty string when given an empty string', () => { const result = (0, strings_1.toUpperSnakeCase)(''); expect(result).toBe(''); }); it('converts mixed case strings', () => { const result = (0, strings_1.toUpperSnakeCase)('Hello World'); expect(result).toBe('HELLO_WORLD'); }); }); //# sourceMappingURL=strings.test.js.map