Skip to content

Commit df83d98

Browse files
committed
added additional test for convertDatesToISOTest
1 parent 4ac03cf commit df83d98

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/unit-tests/middleware/convertDatesToISOTest.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,17 @@ describe('Testing convertDatesToISO', () => {
2828
expect(cveAfterDateFormat.containers.adp[0].timeline[1].time).to.equal('2019-12-13T20:20:39.000Z')
2929
})
3030
})
31+
it('Should successfully format date fields when passed object does not have a cna.containers', async () => {
32+
const cveAfterDateFormat = convertDatesToISO(testCVE.containers.cna, DATE_FIELDS)
33+
34+
// CNA dateUpdated
35+
expect(cveAfterDateFormat.providerMetadata.dateUpdated).to.equal('2018-11-13T20:20:39.000Z')
36+
37+
// CNA date public
38+
expect(cveAfterDateFormat.datePublic).to.equal('2022-02-20T00:00:00.000Z')
39+
40+
// CNA timelines
41+
expect(cveAfterDateFormat.timeline[0].time).to.equal('2018-11-13T20:20:39.000Z')
42+
expect(cveAfterDateFormat.timeline[1].time).to.equal('2019-12-13T20:20:39.000Z')
43+
})
3144
})

0 commit comments

Comments
 (0)