mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-03 15:01:00 +02:00
Use tagged errors in tests
This commit is contained in:
parent
c4500f216e
commit
c48927b7c5
8 changed files with 104 additions and 23 deletions
|
|
@ -324,7 +324,10 @@ describe("Message Types", () => {
|
|||
describe("LibraryResponse", () => {
|
||||
it("should have correct structure", () => {
|
||||
const response: LibraryResponse = {
|
||||
error: new Error(),
|
||||
error: {
|
||||
message: "Library unavailable",
|
||||
type: "library-error",
|
||||
},
|
||||
"document-metadatas": [
|
||||
{
|
||||
id: "doc-1",
|
||||
|
|
@ -334,7 +337,10 @@ describe("Message Types", () => {
|
|||
],
|
||||
};
|
||||
|
||||
expect(response.error).toBeInstanceOf(Error);
|
||||
expect(response.error).toMatchObject({
|
||||
message: "Library unavailable",
|
||||
type: "library-error",
|
||||
});
|
||||
expect(response["document-metadatas"]).toHaveLength(1);
|
||||
expect(response["document-metadatas"]![0].id).toBe("doc-1");
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue