Add hallmarks tests

This commit is contained in:
glebskr
2022-08-04 01:03:45 +03:00
parent 2ea57c12d8
commit adcd826643

14
test.js
View File

@@ -260,6 +260,20 @@ function checkExportKeys(module, filePath, chains) {
exportKeys = Object.keys(exportKeys.reduce((agg, key) => ({...agg, [key]: 1}), {})) // get unique keys
const unknownKeys = exportKeys.filter(key => !whitelistedExportKeys.includes(key))
const hallmarks = module.hallmarks || [];
if (hallmarks.length) {
const TIMESTAMP_LENGTH = 10;
hallmarks.forEach(([timestamp, text]) => {
const strTimestamp = String(timestamp)
if (strTimestamp.length !== TIMESTAMP_LENGTH){
throw new Error(`
Incorrect time format for the hallmark: [${strTimestamp}, ${text}] ,please use unix timestamp
`)
}
})
}
if (unknownChains.length) {
throw new Error(`