aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-types
diff options
context:
space:
mode:
authorGravatar Tiramify (A.K. Daniel) <94789999+TiranexDev@users.noreply.github.com> 2023-08-09 07:14:30 +0200
committerGravatar GitHub <noreply@github.com> 2023-08-08 22:14:30 -0700
commit40d00a961ec4aa4398e18bada520eaf5791151cc (patch)
tree6d47891914742498df7becf253575d633386919c /packages/bun-types
parent1941dbbd71c6d6730ca78b21ef2fd20f51124950 (diff)
downloadbun-40d00a961ec4aa4398e18bada520eaf5791151cc.tar.gz
bun-40d00a961ec4aa4398e18bada520eaf5791151cc.tar.zst
bun-40d00a961ec4aa4398e18bada520eaf5791151cc.zip
feat(bun/test): Implement "toSatisfy" & "toIncludeRepeated" (fwup) (#3651)
* Fix merge issues * oop * make codegen * Fix build issues --------- Co-authored-by: dave caruso <me@paperdave.net>
Diffstat (limited to 'packages/bun-types')
-rw-r--r--packages/bun-types/bun-test.d.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/bun-types/bun-test.d.ts b/packages/bun-types/bun-test.d.ts
index 680d17d2a..f6e968906 100644
--- a/packages/bun-types/bun-test.d.ts
+++ b/packages/bun-types/bun-test.d.ts
@@ -982,6 +982,23 @@ declare module "bun:test" {
*/
toInclude(expected: string): void;
/**
+ * Asserts that a value includes a `string` {times} times.
+ * @param expected the expected substring
+ * @param times the number of times the substring should occur
+ */
+ toIncludeRepeated(expected: string, times: number): void;
+ /**
+ * Checks whether a value satisfies a custom condition.
+ * @param {Function} predicate - The custom condition to be satisfied. It should be a function that takes a value as an argument (in this case the value from expect) and returns a boolean.
+ * @example
+ * expect(1).toSatisfy((val) => val > 0);
+ * expect("foo").toSatisfy((val) => val === "foo");
+ * expect("bar").not.toSatisfy((val) => val === "bun");
+ * @link https://vitest.dev/api/expect.html#tosatisfy
+ * @link https://jest-extended.jestcommunity.dev/docs/matchers/toSatisfy
+ */
+ toSatisfy(predicate: (value: T) => boolean): void;
+ /**
* Asserts that a value starts with a `string`.
*
* @param expected the string to start with