@@ -614,15 +614,15 @@ test('notes are returned as json', async () => {
614614})
615615
616616test (' all notes are returned' , async () => {
617- const notes = await helper . notesInDb () // highlight-line
617+ const response = await api . get ( ' /api/notes ' )
618618
619- assert .strictEqual (notes .length , helper .initialNotes .length ) // highlight-line
619+ assert .strictEqual (response . body .length , helper .initialNotes .length ) // highlight-line
620620})
621621
622622test (' a specific note is within the returned notes' , async () => {
623- const notes = await helper . notesInDb () // highlight-line
623+ const response = await api . get ( ' /api/notes ' )
624624
625- const contents = notes . map (n => n .content )
625+ const contents = response . body . map (e => e .content )
626626 assert (contents .includes (' HTML is easy' ))
627627})
628628
@@ -1078,15 +1078,15 @@ describe('when there is initially some notes saved', () => {
10781078 })
10791079
10801080 test (' all notes are returned' , async () => {
1081- const notes = await helper . notesInDb ( )
1081+ const response = await api . get ( ' /api/notes ' )
10821082
1083- assert .strictEqual (notes .length , helper .initialNotes .length )
1083+ assert .strictEqual (response . body .length , helper .initialNotes .length )
10841084 })
10851085
10861086 test (' a specific note is within the returned notes' , async () => {
1087- const notes = await helper . notesInDb ( )
1087+ const response = await api . get ( ' /api/notes ' )
10881088
1089- const contents = notes . map (n => n .content )
1089+ const contents = response . body . map (e => e .content )
10901090 assert (contents .includes (' HTML is easy' ))
10911091 })
10921092
0 commit comments