Skip to content

Commit

Permalink
Fixes delete response type tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tywalch committed Oct 18, 2024
1 parent c6b350d commit 65792c8
Showing 1 changed file with 45 additions and 2 deletions.
47 changes: 45 additions & 2 deletions index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -969,19 +969,62 @@ entityWithoutSK.delete({ attr1: "asbc" }).where((attr, op) => {
});

// Results
expectAssignable<Promise<Item>>(
expectAssignable<Promise<Item | null>>(
entityWithSK
.delete({ attr1: "abc", attr2: "def" })
.go({ response: "all_old" })
.then((res) => res.data),
);
expectAssignable<Promise<ItemWithoutSK>>(

expectAssignable<Promise<{attr1: string; attr2: string} | null>>(
entityWithSK
.delete({ attr1: "abc", attr2: "def" })
.go({ response: "default" })
.then((res) => res.data),
);

expectAssignable<Promise<{attr1: string; attr2: string} | null>>(
entityWithSK
.delete({ attr1: "abc", attr2: "def" })
.go()
.then((res) => res.data),
);

expectAssignable<Promise<null>>(
entityWithSK
.delete({ attr1: "abc", attr2: "def" })
.go({ response: "none" })
.then((res) => res.data),
);

expectAssignable<Promise<ItemWithoutSK | null>>(
entityWithoutSK
.delete({ attr1: "abc" })
.go({ response: "all_old" })
.then((res) => res.data),
);

expectAssignable<Promise<null>>(
entityWithoutSK
.delete({ attr1: "abc" })
.go({ response: "none" })
.then((res) => res.data),
);

expectAssignable<Promise<{ attr1: string } | null>>(
entityWithoutSK
.delete({ attr1: "abc" })
.go({ response: "default" })
.then((res) => res.data),
);

expectAssignable<Promise<{ attr1: string } | null>>(
entityWithoutSK
.delete({ attr1: "abc" })
.go()
.then((res) => res.data),
);

expectAssignable<"paramtest">(
entityWithSK.delete({ attr1: "abc", attr2: "def" }).params<"paramtest">(),
);
Expand Down

0 comments on commit 65792c8

Please sign in to comment.