summaryrefslogtreecommitdiff
path: root/std/testing/asserts.ts
diff options
context:
space:
mode:
authorTim Reichen <timreichen@users.noreply.github.com>2020-10-26 16:03:30 +0100
committerGitHub <noreply@github.com>2020-10-26 16:03:30 +0100
commitae86cbb551f7b88f83d73a447411f753485e49e2 (patch)
tree312231d858369a0091b23e6310ba82b8d97f57cc /std/testing/asserts.ts
parent305a9c04ba60630f9708b681cfebb522a6110cc3 (diff)
rename(std/testing): rename assert*Contains to assert*Includes (#7951)
This commit renames two assertion functions to better align with JS API: - assertStringContains -> assertStringIncludes - assertArrayContains -> assertArrayIncludes
Diffstat (limited to 'std/testing/asserts.ts')
-rw-r--r--std/testing/asserts.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/std/testing/asserts.ts b/std/testing/asserts.ts
index 1d58f0a00..d46b26ded 100644
--- a/std/testing/asserts.ts
+++ b/std/testing/asserts.ts
@@ -330,10 +330,10 @@ export function assertNotStrictEquals(
}
/**
- * Make an assertion that actual contains expected. If not
+ * Make an assertion that actual includes expected. If not
* then thrown.
*/
-export function assertStringContains(
+export function assertStringIncludes(
actual: string,
expected: string,
msg?: string,
@@ -347,26 +347,26 @@ export function assertStringContains(
}
/**
- * Make an assertion that `actual` contains the `expected` values.
+ * Make an assertion that `actual` includes the `expected` values.
* If not then an error will be thrown.
*
* Type parameter can be specified to ensure values under comparison have the same type.
* For example:
*```ts
- *assertArrayContains<number>([1, 2], [2])
+ *assertArrayIncludes<number>([1, 2], [2])
*```
*/
-export function assertArrayContains(
+export function assertArrayIncludes(
actual: ArrayLike<unknown>,
expected: ArrayLike<unknown>,
msg?: string,
): void;
-export function assertArrayContains<T>(
+export function assertArrayIncludes<T>(
actual: ArrayLike<T>,
expected: ArrayLike<T>,
msg?: string,
): void;
-export function assertArrayContains(
+export function assertArrayIncludes(
actual: ArrayLike<unknown>,
expected: ArrayLike<unknown>,
msg?: string,
@@ -388,7 +388,7 @@ export function assertArrayContains(
return;
}
if (!msg) {
- msg = `actual: "${_format(actual)}" expected to contain: "${
+ msg = `actual: "${_format(actual)}" expected to include: "${
_format(expected)
}"\nmissing: ${_format(missing)}`;
}