File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
client/src/Shared/noteType Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import Note , { checkNotesArr } from './Note'
2+
3+ const noteTemplate = ( ) => {
4+ return {
5+ id : "qweRty123" ,
6+ name : "note" ,
7+ color : "GREEN" ,
8+ text : "lorem ipsum adamet amer" ,
9+ order : 5
10+ }
11+ }
12+
13+ test ( 'Note class' , ( ) => {
14+ const note = noteTemplate ( )
15+ expect ( new Note ( note ) ) . toEqual ( note )
16+ } )
17+
18+ test ( 'checkNotesArr correct' , ( ) => {
19+ let notesArr = [ ]
20+ for ( let i = 0 ; i < 10 ; i ++ ) {
21+ notesArr [ i ] = noteTemplate ( )
22+ notesArr [ i ] . id = String ( Date . now ( ) + i )
23+ notesArr [ i ] . order = Number ( i )
24+ }
25+ expect ( checkNotesArr ( notesArr ) ) . toBeTruthy ( )
26+ } )
27+
28+ test ( 'checkNotesArr incorrect' , ( ) => {
29+ let notesArr = [ ]
30+ for ( let i = 0 ; i < 10 ; i ++ ) {
31+ notesArr [ i ] = noteTemplate ( )
32+ notesArr [ i ] . id = String ( Date . now ( ) + i )
33+ notesArr [ i ] . order = Number ( i )
34+ if ( i === 3 ) delete notesArr [ i ] . id
35+ }
36+ expect ( checkNotesArr ( notesArr ) ) . toBeFalsy ( )
37+ } )
You can’t perform that action at this time.
0 commit comments