Skip to content

Commit 109ef31

Browse files
committed
test: use describe instead of comment sections
1 parent c0be7e1 commit 109ef31

File tree

1 file changed

+138
-138
lines changed

1 file changed

+138
-138
lines changed

test/locale-proxy.spec.ts

+138-138
Original file line numberDiff line numberDiff line change
@@ -10,148 +10,148 @@ describe('LocaleAccess', () => {
1010
airline: { airline: [] } as AirlineDefinitions,
1111
});
1212

13-
// Category-Level checks
14-
15-
it('should be possible to check for a missing category', () => {
16-
expect('category' in locale).toBe(true);
17-
});
18-
19-
it('should be possible to check for an existing category', () => {
20-
expect('airline' in locale).toBe(true);
21-
});
22-
23-
it('should be possible to access the title', () => {
24-
expect(locale.metadata.title).toBe('English');
25-
});
26-
27-
it('should be possible to access a missing category', () => {
28-
expect(locale.category).toBeDefined();
29-
});
30-
31-
it('should not be possible to add a new category', () => {
32-
expect(() => {
33-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
34-
// @ts-ignore
35-
locale.category = {};
36-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
37-
});
38-
39-
it('should not be possible to replace a category', () => {
40-
expect(() => {
41-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
42-
// @ts-ignore
43-
locale.airline = {};
44-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
45-
});
46-
47-
it('should not be possible to delete a missing category', () => {
48-
expect(() => {
49-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
50-
// @ts-ignore
51-
delete locale.category;
52-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
53-
});
54-
55-
it('should not be possible to delete an existing category', () => {
56-
expect(() => {
57-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
58-
// @ts-ignore
59-
delete locale.airline;
60-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
61-
});
62-
63-
// Entry-Level checks
64-
65-
it('should be possible to check for a missing entry in a missing category', () => {
66-
expect('missing' in locale.category).toBe(false);
67-
});
68-
69-
it('should be possible to check for a missing entry in a present category', () => {
70-
expect('missing' in locale.airline).toBe(false);
71-
});
72-
73-
it('should be possible to check for a present entry', () => {
74-
expect('airline' in locale.airline).toBe(true);
75-
});
76-
77-
it('should not be possible to access a missing entry in a missing category', () => {
78-
expect(() => locale.category.missing).toThrowError(
79-
new FakerError(
80-
`The locale data for 'category.missing' are missing in this locale.
13+
describe('category', () => {
14+
it('should be possible to check for a missing category', () => {
15+
expect('category' in locale).toBe(true);
16+
});
17+
18+
it('should be possible to check for an existing category', () => {
19+
expect('airline' in locale).toBe(true);
20+
});
21+
22+
it('should be possible to access the title', () => {
23+
expect(locale.metadata.title).toBe('English');
24+
});
25+
26+
it('should be possible to access a missing category', () => {
27+
expect(locale.category).toBeDefined();
28+
});
29+
30+
it('should not be possible to add a new category', () => {
31+
expect(() => {
32+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
33+
// @ts-ignore
34+
locale.category = {};
35+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
36+
});
37+
38+
it('should not be possible to replace a category', () => {
39+
expect(() => {
40+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
41+
// @ts-ignore
42+
locale.airline = {};
43+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
44+
});
45+
46+
it('should not be possible to delete a missing category', () => {
47+
expect(() => {
48+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
49+
// @ts-ignore
50+
delete locale.category;
51+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
52+
});
53+
54+
it('should not be possible to delete an existing category', () => {
55+
expect(() => {
56+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
57+
// @ts-ignore
58+
delete locale.airline;
59+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
60+
});
61+
});
62+
63+
describe('entry', () => {
64+
it('should be possible to check for a missing entry in a missing category', () => {
65+
expect('missing' in locale.category).toBe(false);
66+
});
67+
68+
it('should be possible to check for a missing entry in a present category', () => {
69+
expect('missing' in locale.airline).toBe(false);
70+
});
71+
72+
it('should be possible to check for a present entry', () => {
73+
expect('airline' in locale.airline).toBe(true);
74+
});
75+
76+
it('should not be possible to access a missing entry in a missing category', () => {
77+
expect(() => locale.category.missing).toThrowError(
78+
new FakerError(
79+
`The locale data for 'category.missing' are missing in this locale.
8180
Please contribute the missing data to the project or use a locale/Faker instance that has these data.
8281
For more information see https://next.fakerjs.dev/guide/localization.html`
83-
)
84-
);
85-
});
86-
87-
it('should not be possible to access a missing entry in a present category', () => {
88-
expect(() => locale.airline.missing).toThrowError(
89-
new FakerError(
90-
`The locale data for 'airline.missing' are missing in this locale.
82+
)
83+
);
84+
});
85+
86+
it('should not be possible to access a missing entry in a present category', () => {
87+
expect(() => locale.airline.missing).toThrowError(
88+
new FakerError(
89+
`The locale data for 'airline.missing' are missing in this locale.
9190
Please contribute the missing data to the project or use a locale/Faker instance that has these data.
9291
For more information see https://next.fakerjs.dev/guide/localization.html`
93-
)
94-
);
95-
});
96-
97-
it('should be possible to access a present entry', () => {
98-
expect(locale.airline.airline).toBeDefined();
99-
});
100-
101-
it('should not be possible to access an unavailable entry in a present category', () => {
102-
expect(() => unavailable.airline.airline).toThrowError(
103-
new FakerError(
104-
`The locale data for 'airline.airline' aren't applicable to this locale.
92+
)
93+
);
94+
});
95+
96+
it('should be possible to access a present entry', () => {
97+
expect(locale.airline.airline).toBeDefined();
98+
});
99+
100+
it('should not be possible to access an unavailable entry in a present category', () => {
101+
expect(() => unavailable.airline.airline).toThrowError(
102+
new FakerError(
103+
`The locale data for 'airline.airline' aren't applicable to this locale.
105104
If you think this is a bug, please report it at: https://github.com/faker-js/faker`
106-
)
107-
);
108-
});
109-
110-
it('should not be possible to add a new entry in a missing category', () => {
111-
expect(() => {
112-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
113-
// @ts-ignore
114-
locale.category.missing = {};
115-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
116-
});
117-
118-
it('should not be possible to add a new entry in an existing category', () => {
119-
expect(() => {
120-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
121-
// @ts-ignore
122-
locale.airline.missing = {};
123-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
124-
});
125-
126-
it('should not be possible to replace an entry in an existing category', () => {
127-
expect(() => {
128-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
129-
// @ts-ignore
130-
locale.airline.airline = [];
131-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
132-
});
133-
134-
it('should not be possible to delete a missing entry in a missing category', () => {
135-
expect(() => {
136-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
137-
// @ts-ignore
138-
delete locale.category.missing;
139-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
140-
});
141-
142-
it('should not be possible to delete a missing entry in an existing category', () => {
143-
expect(() => {
144-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
145-
// @ts-ignore
146-
delete locale.airline.missing;
147-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
148-
});
149-
150-
it('should not be possible to delete an existing entry in an existing category', () => {
151-
expect(() => {
152-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
153-
// @ts-ignore
154-
delete locale.airline.airline;
155-
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
105+
)
106+
);
107+
});
108+
109+
it('should not be possible to add a new entry in a missing category', () => {
110+
expect(() => {
111+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
112+
// @ts-ignore
113+
locale.category.missing = {};
114+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
115+
});
116+
117+
it('should not be possible to add a new entry in an existing category', () => {
118+
expect(() => {
119+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
120+
// @ts-ignore
121+
locale.airline.missing = {};
122+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
123+
});
124+
125+
it('should not be possible to replace an entry in an existing category', () => {
126+
expect(() => {
127+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
128+
// @ts-ignore
129+
locale.airline.airline = [];
130+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
131+
});
132+
133+
it('should not be possible to delete a missing entry in a missing category', () => {
134+
expect(() => {
135+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
136+
// @ts-ignore
137+
delete locale.category.missing;
138+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
139+
});
140+
141+
it('should not be possible to delete a missing entry in an existing category', () => {
142+
expect(() => {
143+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
144+
// @ts-ignore
145+
delete locale.airline.missing;
146+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
147+
});
148+
149+
it('should not be possible to delete an existing entry in an existing category', () => {
150+
expect(() => {
151+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
152+
// @ts-ignore
153+
delete locale.airline.airline;
154+
}).toThrowError(new FakerError('LocaleAccess is read-only.'));
155+
});
156156
});
157157
});

0 commit comments

Comments
 (0)