Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] more specific errors in version validator #8

Merged
merged 1 commit into from
Jan 8, 2021
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@zoralabs/media-metadata-schemas",
"version": "0.0.5",
"version": "0.0.6",
"main": "index.js",
"typings": "dist/src/index.d.ts",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion src/versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function validateVersion(verboseVersion: string): void {

// require calVer exists in `versions`
if(supportedVersions[name].indexOf(calVer) == -1){
throw new Error(`There are no versions with the ${calVer} calendar version`);
throw new Error(`There are no versions in the ${name} namespace with the ${calVer} calendar version`);
}

return;
Expand Down
2 changes: 1 addition & 1 deletion tests/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe("Generator", () => {
it("raises when an unsupported schema version is specified", () => {
expect(() => {
new Generator("zora-20190101")
}).toThrow("There are no versions with the 20190101 calendar version")
}).toThrow("There are no versions in the zora namespace with the 20190101 calendar version")

expect(() => {
new Generator("coinbase-20190101")
Expand Down
4 changes: 2 additions & 2 deletions tests/parser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("Validator", () => {
it("raises when an unsupported schema version is specified", () => {
expect(() => {
new Parser("zora-20190101")
}).toThrow("There are no versions with the 20190101 calendar version")
}).toThrow("There are no versions in the zora namespace with the 20190101 calendar version")

expect(() => {
new Parser("coinbase-20190101")
Expand All @@ -26,7 +26,7 @@ describe("Validator", () => {

const result = validator.parse(JSON.stringify(json));
expect(isZora20210101(result)).toBe(true);
expect(result).toBe(json)
expect(result).toMatchObject(json)
});
})
});
Expand Down
2 changes: 1 addition & 1 deletion tests/validator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe("Validator", () => {
it("raises when an unsupported schema version is specified", () => {
expect(() => {
new Validator("zora-20190101")
}).toThrow("There are no versions with the 20190101 calendar version")
}).toThrow("There are no versions in the zora namespace with the 20190101 calendar version")

expect(() => {
new Validator("coinbase-20190101")
Expand Down