write test for copyright headers

This commit is contained in:
nklhrstv 2021-10-05 14:30:14 +03:00
parent 1412b74e7d
commit 099c799d67

15
tests/copyright.spec.js Normal file
View file

@ -0,0 +1,15 @@
// Copyright (C) 2017-2020 Smart code 203358507
const fs = require('fs');
const readdirp = require('readdirp');
const COPYRIGHT_HEADER = /^\/\/ Copyright \(C\) 2017-2020 Smart code 203358507.*/;
describe('copyright', () => {
test('js', async () => {
for await (const { fullPath } of readdirp('src', { fileFilter: '*.js' })) {
const content = await fs.promises.readFile(fullPath, 'utf8');
expect(content).toEqual(expect.stringMatching(COPYRIGHT_HEADER));
}
});
});