-
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.
feat: strengthen types across all functions
* chore: separate JSON:API types from library types * BREAKING CHANGE: strengthen the JSON:API types and align with the specification document * BREAKING CHANGE: strengthen the types in the deserialisation functions * refactor: remove redendant relationship double-detection routines when deserialising
- Loading branch information
David Brooks
committed
Dec 13, 2021
1 parent
12e3211
commit b83df46
Showing
24 changed files
with
640 additions
and
395 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { describe, expect, it } from "@jest/globals"; | ||
import { attribute } from "../../src"; | ||
|
||
describe("attribute", () => { | ||
it("should throw an error", () => { | ||
const nonJsonapiEntity = () => attribute()(class extends Object {}, "foo"); | ||
|
||
expect(nonJsonapiEntity).toThrow( | ||
"`@attribute` must only be applied to properties of `JsonapiEntity` subtypes" | ||
); | ||
}); | ||
}); |
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,12 @@ | ||
import { describe, expect, it } from "@jest/globals"; | ||
import { link } from "../../src"; | ||
|
||
describe("link", () => { | ||
it("should throw an error", () => { | ||
const nonJsonapiEntity = () => link()(class extends Object {}, "foo"); | ||
|
||
expect(nonJsonapiEntity).toThrow( | ||
"`@link` must only be applied to properties of `JsonapiEntity` subtypes" | ||
); | ||
}); | ||
}); |
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,12 @@ | ||
import { describe, expect, it } from "@jest/globals"; | ||
import { meta } from "../../src"; | ||
|
||
describe("meta", () => { | ||
it("should throw an error", () => { | ||
const nonJsonapiEntity = () => meta()(class extends Object {}, "foo"); | ||
|
||
expect(nonJsonapiEntity).toThrow( | ||
"`@meta` must only be applied to properties of `JsonapiEntity` subtypes" | ||
); | ||
}); | ||
}); |
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,13 @@ | ||
import { describe, expect, it } from "@jest/globals"; | ||
import { relationship } from "../../src"; | ||
|
||
describe("relationship", () => { | ||
it("should throw an error", () => { | ||
const nonJsonapiEntity = () => | ||
relationship()(class extends Object {}, "foo"); | ||
|
||
expect(nonJsonapiEntity).toThrow( | ||
"`@relationship` must only be applied to properties of `JsonapiEntity` subtypes" | ||
); | ||
}); | ||
}); |
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
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
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.