add new test

This commit is contained in:
Woody 2024-01-16 22:38:01 +01:00
parent 04c3a925cc
commit e0f987328b
No known key found for this signature in database
GPG Key ID: 9872D7F5072789B2

View File

@ -171,5 +171,24 @@ describe('General functionality', () => {
const currentTime = Date.now();
assert(currentTime - modifiedTime < 500, 'html_ui.h was not modified');
});
it('should rebuild if a inlined file changes', async () => {
// run script cdata.js and wait for it to finish
await execPromise('node tools/cdata.js');
// modify index.htm
fs.appendFileSync(path.join(dataPath, 'index.js'), ' ');
// delay for 1 second to ensure the modified time is different
await new Promise(resolve => setTimeout(resolve, 1000));
// run script cdata.js and wait for it to finish
await execPromise('node tools/cdata.js');
// check if html_ui.h was modified
const stats = fs.statSync(path.join(folderPath, 'html_ui.h'));
const modifiedTime = stats.mtimeMs;
const currentTime = Date.now();
assert(currentTime - modifiedTime < 500, 'html_ui.h was not modified');
});
});
});