mirror of
https://github.com/web3privacy/data
synced 2024-10-15 18:16:28 +02:00
code for privacy corner is "c"
This commit is contained in:
parent
85bad09cb2
commit
27e4d6c46a
2 changed files with 37 additions and 2 deletions
|
@ -333,7 +333,7 @@
|
|||
speakers:
|
||||
- mykola-siusko
|
||||
|
||||
- id: pc24rom
|
||||
- id: c24rom
|
||||
issue: 23
|
||||
type: privacy-corner
|
||||
date: "2024-10-04"
|
||||
|
@ -364,7 +364,7 @@
|
|||
- pg
|
||||
- tree
|
||||
|
||||
- id: pc24brn
|
||||
- id: c24brn
|
||||
issue: 24
|
||||
type: privacy-corner
|
||||
date: "2024-10-25"
|
||||
|
|
|
@ -23,3 +23,38 @@ function checkCollection(name, schema, data) {
|
|||
|
||||
// check index
|
||||
checkCollection("index", engine.schemas.index, engine.rendered);
|
||||
|
||||
// check events
|
||||
const eventTypes = {
|
||||
summit: { code: "s" },
|
||||
meetup: { code: "m" },
|
||||
hackathon: { code: "h" },
|
||||
"privacy-corner": { code: "c" },
|
||||
};
|
||||
const usedIds = [];
|
||||
for (const event of engine.rendered.events) {
|
||||
Deno.test(`event: ${event.id}`, () => {
|
||||
// check id duplicates
|
||||
if (usedIds.includes(event.id)) {
|
||||
throw `Duplicate ID: ${event.id}`;
|
||||
}
|
||||
usedIds.push(event.id);
|
||||
|
||||
// check id
|
||||
const codes = Object.keys(eventTypes).map((et) => eventTypes[et].code);
|
||||
const match = event.id.match(
|
||||
new RegExp(`^(${codes.join("|")})(\\d{2})(\\w{2,3})$`),
|
||||
);
|
||||
if (!match) {
|
||||
throw `Bad event id: ${event.id}`;
|
||||
}
|
||||
const [_, type, year, location] = match;
|
||||
if (eventTypes[event.type].code !== type) {
|
||||
throw `ID doesnt reflect event type: id=${event.id} type=${event.type}`;
|
||||
}
|
||||
const eventYear = event.date.match(/^\d{2}(\d{2})/)[1];
|
||||
if (year !== eventYear) {
|
||||
throw `ID doesnt reflect event year: id=${event.id} date=${event.date}`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue