Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz committed Dec 3, 2023
1 parent 9858396 commit 40d64a4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/validate/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ describe('Validate', () => {
});
});

it('vendors', async () => {
it('vendors', async() => {
const { createHash } = require('crypto');
const { getVendors } = require('../../scripts/events/lib/utils');
const vendorsFile = fs.readFileSync(path.join(__dirname, '../../_vendors.yml'));
(await Promise.all(Object.entries(yaml.load(vendorsFile)).map(async ([key, vendor]) => {
(await Promise.all(Object.entries(yaml.load(vendorsFile)).map(async([key, vendor]) => {
vendor.minified = vendor.file || '';
const { cdnjs } = getVendors(vendor);
// fetch content and check sha256
return await fetch(cdnjs)
.then((response) => response.text())
.then((body) => {
.then(response => response.text())
.then(body => {
const integrity = Buffer.from(createHash('sha256').update(body, 'utf8').digest()).toString('base64');
return !vendor.integrity || "sha256-" + integrity == vendor.integrity;
return !vendor.integrity || 'sha256-' + integrity === vendor.integrity;
});
}))).should.all.equal(true);
});
Expand Down

0 comments on commit 40d64a4

Please sign in to comment.