Skip to content

Commit 6597a84

Browse files
committed
test(student-profile): add empty fallback coverage
1 parent 9e2b68c commit 6597a84

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import mongoose from 'mongoose';
2+
import { describe, expect, it } from 'vitest';
3+
import { StudentProfile } from './StudentProfile';
4+
5+
describe('StudentProfile Empty Fallback', () => {
6+
it('uses empty string as default phone value', () => {
7+
const phonePath = StudentProfile.schema.path('phone') as mongoose.SchemaType & {
8+
options: Record<string, unknown>;
9+
};
10+
11+
expect(phonePath.options.default).toBe('');
12+
});
13+
14+
it('uses empty string as default experience description', () => {
15+
const experiencePath = StudentProfile.schema.path('experience');
16+
17+
expect(experiencePath).toBeDefined();
18+
});
19+
20+
it('allows skills to exist as an empty array', () => {
21+
const skillsPath = StudentProfile.schema.path('skills') as unknown as {
22+
instance: string;
23+
};
24+
25+
expect(skillsPath.instance).toBe('Array');
26+
});
27+
28+
it('allows education to exist as an empty array', () => {
29+
const educationPath = StudentProfile.schema.path('education') as unknown as {
30+
instance: string;
31+
};
32+
33+
expect(educationPath.instance).toBe('Array');
34+
});
35+
36+
it('allows experience to exist as an empty array', () => {
37+
const experiencePath = StudentProfile.schema.path('experience') as unknown as {
38+
instance: string;
39+
};
40+
41+
expect(experiencePath.instance).toBe('Array');
42+
});
43+
});

0 commit comments

Comments
 (0)