-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #388 from M-L-D-H/tsb
Add CRediT role IDs
- Loading branch information
Showing
2 changed files
with
38 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import { v4 } from "https://deno.land/[email protected]/uuid/mod.ts"; | ||
import { keywords, projectSchema } from "../SCHEMATA/project_schema.ts"; | ||
import { | ||
creditRoles, | ||
keywords, | ||
projectSchema, | ||
} from "../SCHEMATA/project_schema.ts"; | ||
|
||
Deno.test("ensure no duplicate keywords", () => { | ||
const keywordsSet = new Set(keywords); | ||
|
@@ -19,6 +23,18 @@ Deno.test("validate project template", () => { | |
projectSchema.parse(template); | ||
}); | ||
|
||
Deno.test("ensure no duplicate CRediT role IDs", () => { | ||
const ids = creditRoles.map(([, id]) => id); | ||
const idSet = new Set(ids); | ||
assertEquals(idSet.size, 14); // There are 14 roles | ||
}); | ||
|
||
for (const [_, id] of creditRoles) { | ||
Deno.test(`validate CRediT role ID ${id}`, () => { | ||
assertEquals(v4.validate(id), true); | ||
}); | ||
} | ||
|
||
// Get list of project files | ||
const projectsFile = Deno.readTextFileSync("PROJECTS.json"); | ||
const projectsObj = JSON.parse(projectsFile); | ||
|