From a05f2dc27bfc0c9201a235860bf98ac156e56b69 Mon Sep 17 00:00:00 2001 From: Breck Stodghill Date: Fri, 8 Jan 2021 12:12:10 -0800 Subject: [PATCH] [chore] more specific errors in version validator --- package.json | 2 +- src/versions.ts | 2 +- tests/generator.test.ts | 2 +- tests/parser.test.ts | 4 ++-- tests/validator.test.ts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f6dafcc..a174d03 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/src/versions.ts b/src/versions.ts index 7a4428b..1ae91f4 100644 --- a/src/versions.ts +++ b/src/versions.ts @@ -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; diff --git a/tests/generator.test.ts b/tests/generator.test.ts index cec280a..dc37272 100644 --- a/tests/generator.test.ts +++ b/tests/generator.test.ts @@ -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") diff --git a/tests/parser.test.ts b/tests/parser.test.ts index d739a31..51b79b8 100644 --- a/tests/parser.test.ts +++ b/tests/parser.test.ts @@ -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") @@ -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) }); }) }); diff --git a/tests/validator.test.ts b/tests/validator.test.ts index 7fa9cee..11ba70f 100644 --- a/tests/validator.test.ts +++ b/tests/validator.test.ts @@ -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")