File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ } ) ;
You can’t perform that action at this time.
0 commit comments