-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtranslatedVariableDictionary.spec.ts
62 lines (49 loc) · 2.76 KB
/
translatedVariableDictionary.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import { describe, it, expectTypeOf, expect } from 'vitest';
import { translatedVariableDictionary, variable } from './translatedVariableDictionary';
import * as H from 'hotscript';
describe('variable function', () => {
it('should return correct variable name for single argument', () => {
const result = variable('test');
expect(result).toBe('test');
});
it('should return correct variable name for multiple arguments', () => {
const result = variable('foo', 'bar', 'baz');
expect(result).toBe('fooBarBaz');
});
it('should handle string arguments correctly', () => {
const result = variable('Hello', 'World');
expect(result).toBe('helloWorld');
});
it('should return correct type for single argument', () => {
const result: H.Call<H.Strings.CamelCase, 'test'> = variable('test');
expect(typeof result).toBe('string');
});
it('should return correct type for multiple arguments', () => {
const result: H.Pipe<
['foo', 'bar', 'baz'],
[H.Tuples.Map<H.Strings.Capitalize>, H.Tuples.Join<''>, H.Strings.Uncapitalize]
> = variable('foo', 'bar', 'baz');
expect(typeof result).toBe('string');
});
});
describe('translatedVariableDictionary', () => {
it('should have correct types', () => {
// Test the type of the entire object
expectTypeOf(translatedVariableDictionary).toEqualTypeOf<typeof translatedVariableDictionary>();
// Test the types of individual properties
expectTypeOf(translatedVariableDictionary.국회의원코드).toEqualTypeOf<'lawmakerCode'>();
expect(translatedVariableDictionary.국회의원코드).toBe('lawmakerCode');
expectTypeOf(translatedVariableDictionary.국회의원명).toEqualTypeOf<'lawmakerName'>();
expect(translatedVariableDictionary.국회의원명).toBe('lawmakerName');
expectTypeOf(translatedVariableDictionary.국회의원한자명).toEqualTypeOf<'lawmakerChineseName'>();
expect(translatedVariableDictionary.국회의원한자명).toBe('lawmakerChineseName');
expectTypeOf(translatedVariableDictionary.국회의원영문명).toEqualTypeOf<'lawmakerEnglishName'>();
expect(translatedVariableDictionary.국회의원영문명).toBe('lawmakerEnglishName');
expectTypeOf(translatedVariableDictionary.생일구분코드).toEqualTypeOf<'birthdayDivisionCode'>();
expect(translatedVariableDictionary.생일구분코드).toBe('birthdayDivisionCode');
expectTypeOf(translatedVariableDictionary.당선대수).toEqualTypeOf<'electionCongress'>();
expect(translatedVariableDictionary.당선대수).toBe('electionCongress');
expectTypeOf(translatedVariableDictionary.위원회심사_처리일).toEqualTypeOf<'committeeReviewProcessDate'>();
expect(translatedVariableDictionary.위원회심사_처리일).toBe('committeeReviewProcessDate');
});
});