Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test": "npm-run-all test:data test:js",
"test:data": "node scripts/test-communities.js && node scripts/test-conferences.js",
"test:js": "jest",
"test:data:url": "node scripts/test-communities-check-url.mjs",
"watch": "npm-run-all build:communities build:conferences build:conferences-ics -p dev"
},
"jest": {
Expand Down
24 changes: 24 additions & 0 deletions scripts/test-communities-check-url.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import path from 'path';
import fs from 'fs';

const communitiesDir = path.resolve(import.meta.dirname, '../communities/');

const communitiesPath = fs
.readdirSync(communitiesDir)
.filter(file => file.endsWith('.json'))
.map(file => path.join(communitiesDir, file));

const communities = communitiesPath
.map(file => fs.readFileSync(file).toString())
.map(fileContent => JSON.parse(fileContent));

const fetchCommunities = communities.map(community => fetch(community.url));

const failedURL = (await Promise.all(fetchCommunities))
.filter(communityResponse => !communityResponse.ok)
.map(communityResponse => communityResponse.url);

if (failedURL.length > 0) {
console.log(failedURL);
process.exit(1);
}
Loading