|
1 | 1 | import { assertType, describe, expectTypeOf, it } from 'vitest';
|
| 2 | +import { lowercase, uppercase } from './case-conversions.js'; |
2 | 3 | import type { CamelCaseToKebabCase, KebabCaseToCamelCase } from './types.js';
|
3 | 4 |
|
4 |
| -/* eslint-disable vitest/expect-expect */ |
5 | 5 | describe('CamelCaseToKebabCase', () => {
|
6 | 6 | // ✅ CamelCase → kebab-case Type Tests
|
7 | 7 |
|
@@ -60,4 +60,37 @@ describe('CamelCaseToKebabCase', () => {
|
60 | 60 | assertType<KebabCaseToCamelCase<'this-Is-Wrong'>>();
|
61 | 61 | });
|
62 | 62 | });
|
63 |
| -/* eslint-enable vitest/expect-expect */ |
| 63 | + |
| 64 | +describe('lowercase', () => { |
| 65 | + it('converts string literal to lowercased literal', () => { |
| 66 | + expectTypeOf(lowercase('Warning' as const)).toEqualTypeOf<'warning'>(); |
| 67 | + }); |
| 68 | + |
| 69 | + it('converts enum value to lowercased string literal', () => { |
| 70 | + enum Severity { |
| 71 | + Warning = 'Warning', |
| 72 | + } |
| 73 | + expectTypeOf(lowercase(Severity.Warning)).toEqualTypeOf<'warning'>(); |
| 74 | + }); |
| 75 | + |
| 76 | + it('converts string to string', () => { |
| 77 | + expectTypeOf(lowercase('hello, world')).toBeString(); |
| 78 | + }); |
| 79 | +}); |
| 80 | + |
| 81 | +describe('uppercase', () => { |
| 82 | + it('converts string literal to uppercased literal', () => { |
| 83 | + expectTypeOf(uppercase('Warning' as const)).toEqualTypeOf<'WARNING'>(); |
| 84 | + }); |
| 85 | + |
| 86 | + it('converts enum value to uppercased string literal', () => { |
| 87 | + enum Severity { |
| 88 | + Warning = 'Warning', |
| 89 | + } |
| 90 | + expectTypeOf(uppercase(Severity.Warning)).toEqualTypeOf<'WARNING'>(); |
| 91 | + }); |
| 92 | + |
| 93 | + it('converts string to string', () => { |
| 94 | + expectTypeOf(uppercase('hello, world')).toBeString(); |
| 95 | + }); |
| 96 | +}); |
0 commit comments