-
Notifications
You must be signed in to change notification settings - Fork 0
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 #32 from DigitalCommons/add-vocabs-route
Add vocabs API route
- Loading branch information
Showing
8 changed files
with
757 additions
and
61 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"prefixes": { | ||
"https://dev.lod.coop/essglobal/2.1/standard/activities-modified/": "am" | ||
}, | ||
"vocabs": { | ||
"am": { | ||
"en": { | ||
"title": "Activities (Modified)", | ||
"terms": { | ||
"AM10": "Arts, Media, Culture & Leisure", | ||
"AM20": "Campaigning, Activism & Advocacy", | ||
"AM30": "Community & Collective Spaces", | ||
"AM40": "Education", | ||
"AM50": "Energy", | ||
"AM60": "Food", | ||
"AM70": "Goods & Services", | ||
"AM80": "Health, Social Care & Wellbeing", | ||
"AM90": "Housing", | ||
"AM100": "Money & Finance", | ||
"AM110": "Nature, Conservation & Environment", | ||
"AM120": "Reduce, Reuse, Repair & Recycle", | ||
"AM130": "Agriculture", | ||
"AM140": "Industry", | ||
"AM150": "Utilities", | ||
"AM160": "Transport" | ||
} | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
import { expect, test } from "vitest"; | ||
import { schemas } from "@mykomap/common"; | ||
|
||
const { DatasetId, QName } = schemas; | ||
const { DatasetId, QName, PrefixUri } = schemas; | ||
|
||
test("testing DatasetId validation", async (t) => { | ||
const expectTrue = ["0", "A", "z", "_", "-", "01234", "Quick-Brown-Fox_42"]; | ||
|
@@ -42,3 +42,86 @@ test("testing QName validation", async (t) => { | |
expect(QName.safeParse(it).success, `parsing '${it}'`).toBeFalsy(), | ||
); | ||
}); | ||
|
||
test("testing PrefixUri validation", async (t) => { | ||
const expectTrue = [ | ||
"http://a", | ||
"http://a/", | ||
"http://e.a", | ||
"http://e.a/", | ||
"http://example.com", | ||
"http://EXAMPLE.COM", | ||
"http://example.Com", | ||
"https://example.com", | ||
"http://www.example.com", | ||
"http://www.example.com/", | ||
"https://w3-example/", | ||
"https://w3-example1.com/", | ||
"http://example.com#", | ||
"http://example.com/#", | ||
"http://example.com/foo", | ||
"http://example.com/foo/", | ||
"http://example.com/foo/bar", | ||
"http://example.com/foo/bar/", | ||
"http://example.com/foo#", | ||
"http://example.com/foo/#", | ||
"http://example.com/foo/bar#", | ||
"http://example.com/foo/bar/#", | ||
"http://example.com/%2e%4F", | ||
"http://example.com/A-Za-z0-9._~!$&'()*+,;=:@-%20/", | ||
]; | ||
const expectFalse = [ | ||
"http://", | ||
"http://-", | ||
"http://.", | ||
"http://.a", | ||
"http://-a", | ||
"http://a-", | ||
"http://a.", | ||
"http://3a.com", | ||
"http://a.3com", | ||
"http://-a.com", | ||
"http://a-.com", | ||
"http://a.-com", | ||
"http://a.-com", | ||
"http://a.com-", | ||
"http://a_b", | ||
"http://a_b.c", | ||
"http://a@b", | ||
"http://[email protected]", | ||
"http://a:b.c", | ||
"http://b.c:8000", | ||
"HTTP://example.com", | ||
"Http://example.com", | ||
"htt://example.com", | ||
"httpss://example.com", | ||
"http//example.com", | ||
"http:/example.com", | ||
"http:///example.com", | ||
"http//:/example.com", | ||
"http/example.com", | ||
"http/:example.com", | ||
"http//:example.com", | ||
"http://example.com?", | ||
"http://example.com/?", | ||
"http://example.com?q", | ||
"http://example.com/?q", | ||
"http://example.com/foo?q", | ||
"http://example.com/foo/?q", | ||
"http://example.com/#?", | ||
"http://example.com#?", | ||
"http://example.com#q", | ||
"http://example.com/#q", | ||
'http://example.com/foo"bar', | ||
"http://example.com//foobar", | ||
"http://example.com/foo//bar", | ||
"http://example.com/foobar//", | ||
]; | ||
|
||
expectTrue.forEach((it) => | ||
expect(PrefixUri.safeParse(it).success, `parsing '${it}'`).toBeTruthy(), | ||
); | ||
expectFalse.forEach((it) => | ||
expect(PrefixUri.safeParse(it).success, `parsing '${it}'`).toBeFalsy(), | ||
); | ||
}); |
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
Oops, something went wrong.