@kensio/smartass 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -9
- package/dist/assert/array-equals/array-equals.test.d.ts +2 -0
- package/dist/assert/array-equals/array-equals.test.d.ts.map +1 -0
- package/dist/assert/array-equals/array-equals.test.js +39 -0
- package/dist/assert/array-equals/array-equals.test.js.map +1 -0
- package/dist/assert/array-includes/array-includes.match.d.ts +5 -3
- package/dist/assert/array-includes/array-includes.match.d.ts.map +1 -1
- package/dist/assert/array-includes/array-includes.match.js.map +1 -1
- package/dist/assert/array-includes/array-includes.test.d.ts +2 -0
- package/dist/assert/array-includes/array-includes.test.d.ts.map +1 -0
- package/dist/assert/array-includes/array-includes.test.js +79 -0
- package/dist/assert/array-includes/array-includes.test.js.map +1 -0
- package/dist/assert/array-includes-all/array-includes-all.match.d.ts +5 -6
- package/dist/assert/array-includes-all/array-includes-all.match.d.ts.map +1 -1
- package/dist/assert/array-includes-all/array-includes-all.match.js.map +1 -1
- package/dist/assert/array-includes-all/array-includes-all.test.d.ts +2 -0
- package/dist/assert/array-includes-all/array-includes-all.test.d.ts.map +1 -0
- package/dist/assert/array-includes-all/array-includes-all.test.js +163 -0
- package/dist/assert/array-includes-all/array-includes-all.test.js.map +1 -0
- package/dist/assert/array-length/array-length.match.d.ts +7 -2
- package/dist/assert/array-length/array-length.match.d.ts.map +1 -1
- package/dist/assert/array-length/array-length.match.js +1 -1
- package/dist/assert/array-length/array-length.match.js.map +1 -1
- package/dist/assert/array-length/array-length.test.d.ts +2 -0
- package/dist/assert/array-length/array-length.test.d.ts.map +1 -0
- package/dist/assert/array-length/array-length.test.js +104 -0
- package/dist/assert/array-length/array-length.test.js.map +1 -0
- package/dist/assert/array-min-length/array-min-length.match.d.ts +2 -1
- package/dist/assert/array-min-length/array-min-length.match.d.ts.map +1 -1
- package/dist/assert/array-min-length/array-min-length.match.js.map +1 -1
- package/dist/assert/array-min-length/array-min-length.test.d.ts +2 -0
- package/dist/assert/array-min-length/array-min-length.test.d.ts.map +1 -0
- package/dist/assert/array-min-length/array-min-length.test.js +115 -0
- package/dist/assert/array-min-length/array-min-length.test.js.map +1 -0
- package/dist/assert/array-not-empty/array-not-empty.assert.js.map +1 -1
- package/dist/assert/array-not-empty/array-not-empty.match.d.ts +2 -1
- package/dist/assert/array-not-empty/array-not-empty.match.d.ts.map +1 -1
- package/dist/assert/array-not-empty/array-not-empty.match.js +1 -1
- package/dist/assert/array-not-empty/array-not-empty.match.js.map +1 -1
- package/dist/assert/array-not-empty/array-not-empty.test.d.ts +2 -0
- package/dist/assert/array-not-empty/array-not-empty.test.d.ts.map +1 -0
- package/dist/assert/array-not-empty/array-not-empty.test.js +76 -0
- package/dist/assert/array-not-empty/array-not-empty.test.js.map +1 -0
- package/dist/assert/buffer-equal/buffer-equal.assert.d.ts +1 -1
- package/dist/assert/buffer-equal/buffer-equal.assert.d.ts.map +1 -1
- package/dist/assert/buffer-equal/buffer-equal.assert.js.map +1 -1
- package/dist/assert/buffer-equal/buffer-equal.match.d.ts +1 -1
- package/dist/assert/buffer-equal/buffer-equal.match.d.ts.map +1 -1
- package/dist/assert/buffer-equal/buffer-equal.match.js +1 -1
- package/dist/assert/buffer-equal/buffer-equal.match.js.map +1 -1
- package/dist/assert/buffer-equal/buffer-equal.test.d.ts +2 -0
- package/dist/assert/buffer-equal/buffer-equal.test.d.ts.map +1 -0
- package/dist/assert/buffer-equal/buffer-equal.test.js +170 -0
- package/dist/assert/buffer-equal/buffer-equal.test.js.map +1 -0
- package/dist/assert/false/false.test.d.ts +2 -0
- package/dist/assert/false/false.test.d.ts.map +1 -0
- package/dist/assert/false/false.test.js +45 -0
- package/dist/assert/false/false.test.js.map +1 -0
- package/dist/assert/identical/identical.test.d.ts +2 -0
- package/dist/assert/identical/identical.test.d.ts.map +1 -0
- package/dist/assert/identical/identical.test.js +61 -0
- package/dist/assert/identical/identical.test.js.map +1 -0
- package/dist/assert/instance-of/instance-of.assert.d.ts +2 -1
- package/dist/assert/instance-of/instance-of.assert.d.ts.map +1 -1
- package/dist/assert/instance-of/instance-of.assert.js.map +1 -1
- package/dist/assert/instance-of/instance-of.match.d.ts +2 -1
- package/dist/assert/instance-of/instance-of.match.d.ts.map +1 -1
- package/dist/assert/instance-of/instance-of.match.js.map +1 -1
- package/dist/assert/instance-of/instance-of.test.d.ts +2 -0
- package/dist/assert/instance-of/instance-of.test.d.ts.map +1 -0
- package/dist/assert/instance-of/instance-of.test.js +112 -0
- package/dist/assert/instance-of/instance-of.test.js.map +1 -0
- package/dist/assert/non-nullable/non-nullable.test.d.ts +2 -0
- package/dist/assert/non-nullable/non-nullable.test.d.ts.map +1 -0
- package/dist/assert/non-nullable/non-nullable.test.js +64 -0
- package/dist/assert/non-nullable/non-nullable.test.js.map +1 -0
- package/dist/assert/number-between/number-between.test.d.ts +2 -0
- package/dist/assert/number-between/number-between.test.d.ts.map +1 -0
- package/dist/assert/number-between/number-between.test.js +185 -0
- package/dist/assert/number-between/number-between.test.js.map +1 -0
- package/dist/assert/number-to-nearest/number-to-nearest.test.d.ts +2 -0
- package/dist/assert/number-to-nearest/number-to-nearest.test.d.ts.map +1 -0
- package/dist/assert/number-to-nearest/number-to-nearest.test.js +129 -0
- package/dist/assert/number-to-nearest/number-to-nearest.test.js.map +1 -0
- package/dist/assert/object-equals/object-equals.test.d.ts +2 -0
- package/dist/assert/object-equals/object-equals.test.d.ts.map +1 -0
- package/dist/assert/object-equals/object-equals.test.js +87 -0
- package/dist/assert/object-equals/object-equals.test.js.map +1 -0
- package/dist/assert/object-has-property/object-has-property.assert.d.ts +1 -1
- package/dist/assert/object-has-property/object-has-property.assert.d.ts.map +1 -1
- package/dist/assert/object-has-property/object-has-property.match.d.ts +8 -3
- package/dist/assert/object-has-property/object-has-property.match.d.ts.map +1 -1
- package/dist/assert/object-has-property/object-has-property.match.js +1 -1
- package/dist/assert/object-has-property/object-has-property.match.js.map +1 -1
- package/dist/assert/object-has-property/object-has-property.test.d.ts +2 -0
- package/dist/assert/object-has-property/object-has-property.test.d.ts.map +1 -0
- package/dist/assert/object-has-property/object-has-property.test.js +123 -0
- package/dist/assert/object-has-property/object-has-property.test.js.map +1 -0
- package/dist/assert/object-matches/object-matches.assert.d.ts +26 -7
- package/dist/assert/object-matches/object-matches.assert.d.ts.map +1 -1
- package/dist/assert/object-matches/object-matches.assert.js.map +1 -1
- package/dist/assert/object-matches/object-matches.test.d.ts +2 -0
- package/dist/assert/object-matches/object-matches.test.d.ts.map +1 -0
- package/dist/assert/object-matches/object-matches.test.js +134 -0
- package/dist/assert/object-matches/object-matches.test.js.map +1 -0
- package/dist/assert/one-of/one-of.test.d.ts +2 -0
- package/dist/assert/one-of/one-of.test.d.ts.map +1 -0
- package/dist/assert/one-of/one-of.test.js +122 -0
- package/dist/assert/one-of/one-of.test.js.map +1 -0
- package/dist/assert/string-ends-with/string-ends-with.match.js +1 -1
- package/dist/assert/string-ends-with/string-ends-with.test.d.ts +2 -0
- package/dist/assert/string-ends-with/string-ends-with.test.d.ts.map +1 -0
- package/dist/assert/string-ends-with/string-ends-with.test.js +104 -0
- package/dist/assert/string-ends-with/string-ends-with.test.js.map +1 -0
- package/dist/assert/string-includes/string-includes.test.d.ts +2 -0
- package/dist/assert/string-includes/string-includes.test.d.ts.map +1 -0
- package/dist/assert/string-includes/string-includes.test.js +115 -0
- package/dist/assert/string-includes/string-includes.test.js.map +1 -0
- package/dist/assert/string-length/string-length.match.d.ts +5 -2
- package/dist/assert/string-length/string-length.match.d.ts.map +1 -1
- package/dist/assert/string-length/string-length.match.js +1 -1
- package/dist/assert/string-length/string-length.match.js.map +1 -1
- package/dist/assert/string-length/string-length.test.d.ts +2 -0
- package/dist/assert/string-length/string-length.test.d.ts.map +1 -0
- package/dist/assert/string-length/string-length.test.js +151 -0
- package/dist/assert/string-length/string-length.test.js.map +1 -0
- package/dist/assert/string-not-includes/string-not-includes.test.d.ts +2 -0
- package/dist/assert/string-not-includes/string-not-includes.test.d.ts.map +1 -0
- package/dist/assert/string-not-includes/string-not-includes.test.js +124 -0
- package/dist/assert/string-not-includes/string-not-includes.test.js.map +1 -0
- package/dist/assert/string-starts-with/string-starts-with.assert.d.ts.map +1 -1
- package/dist/assert/string-starts-with/string-starts-with.assert.js +4 -2
- package/dist/assert/string-starts-with/string-starts-with.assert.js.map +1 -1
- package/dist/assert/string-starts-with/string-starts-with.match.d.ts +6 -0
- package/dist/assert/string-starts-with/string-starts-with.match.d.ts.map +1 -0
- package/dist/assert/string-starts-with/string-starts-with.match.js +9 -0
- package/dist/assert/string-starts-with/string-starts-with.match.js.map +1 -0
- package/dist/assert/string-starts-with/string-starts-with.test.d.ts +2 -0
- package/dist/assert/string-starts-with/string-starts-with.test.d.ts.map +1 -0
- package/dist/assert/string-starts-with/string-starts-with.test.js +90 -0
- package/dist/assert/string-starts-with/string-starts-with.test.js.map +1 -0
- package/dist/assert/throws-error/throws-error.test.d.ts +2 -0
- package/dist/assert/throws-error/throws-error.test.d.ts.map +1 -0
- package/dist/assert/throws-error/throws-error.test.js +74 -0
- package/dist/assert/throws-error/throws-error.test.js.map +1 -0
- package/dist/assert/throws-error-async/throws-error-async.test.d.ts +2 -0
- package/dist/assert/throws-error-async/throws-error-async.test.d.ts.map +1 -0
- package/dist/assert/throws-error-async/throws-error-async.test.js +61 -0
- package/dist/assert/throws-error-async/throws-error-async.test.js.map +1 -0
- package/dist/assert/throws-error-like/throws-error-like.test.d.ts +2 -0
- package/dist/assert/throws-error-like/throws-error-like.test.d.ts.map +1 -0
- package/dist/assert/throws-error-like/throws-error-like.test.js +151 -0
- package/dist/assert/throws-error-like/throws-error-like.test.js.map +1 -0
- package/dist/assert/true/true.test.d.ts +2 -0
- package/dist/assert/true/true.test.d.ts.map +1 -0
- package/dist/assert/true/true.test.js +45 -0
- package/dist/assert/true/true.test.js.map +1 -0
- package/dist/assert/type-bigint/type-bigint.assert.d.ts.map +1 -1
- package/dist/assert/type-bigint/type-bigint.assert.js +4 -2
- package/dist/assert/type-bigint/type-bigint.assert.js.map +1 -1
- package/dist/assert/type-bigint/type-bigint.match.d.ts +6 -0
- package/dist/assert/type-bigint/type-bigint.match.d.ts.map +1 -0
- package/dist/assert/type-bigint/type-bigint.match.js +8 -0
- package/dist/assert/type-bigint/type-bigint.match.js.map +1 -0
- package/dist/assert/type-bigint/type-bigint.test.d.ts +2 -0
- package/dist/assert/type-bigint/type-bigint.test.d.ts.map +1 -0
- package/dist/assert/type-bigint/type-bigint.test.js +83 -0
- package/dist/assert/type-bigint/type-bigint.test.js.map +1 -0
- package/dist/assert/type-boolean/type-boolean.assert.d.ts.map +1 -1
- package/dist/assert/type-boolean/type-boolean.assert.js +4 -2
- package/dist/assert/type-boolean/type-boolean.assert.js.map +1 -1
- package/dist/assert/type-boolean/type-boolean.match.d.ts +6 -0
- package/dist/assert/type-boolean/type-boolean.match.d.ts.map +1 -0
- package/dist/assert/type-boolean/type-boolean.match.js +8 -0
- package/dist/assert/type-boolean/type-boolean.match.js.map +1 -0
- package/dist/assert/type-boolean/type-boolean.test.d.ts +2 -0
- package/dist/assert/type-boolean/type-boolean.test.d.ts.map +1 -0
- package/dist/assert/type-boolean/type-boolean.test.js +64 -0
- package/dist/assert/type-boolean/type-boolean.test.js.map +1 -0
- package/dist/assert/type-function/type-function.assert.d.ts.map +1 -1
- package/dist/assert/type-function/type-function.assert.js +4 -2
- package/dist/assert/type-function/type-function.assert.js.map +1 -1
- package/dist/assert/type-function/type-function.match.d.ts +6 -0
- package/dist/assert/type-function/type-function.match.d.ts.map +1 -0
- package/dist/assert/type-function/type-function.match.js +11 -0
- package/dist/assert/type-function/type-function.match.js.map +1 -0
- package/dist/assert/type-function/type-function.test.d.ts +2 -0
- package/dist/assert/type-function/type-function.test.d.ts.map +1 -0
- package/dist/assert/type-function/type-function.test.js +84 -0
- package/dist/assert/type-function/type-function.test.js.map +1 -0
- package/dist/assert/type-number/type-number.assert.d.ts.map +1 -1
- package/dist/assert/type-number/type-number.assert.js +4 -2
- package/dist/assert/type-number/type-number.assert.js.map +1 -1
- package/dist/assert/type-number/type-number.match.d.ts +6 -0
- package/dist/assert/type-number/type-number.match.d.ts.map +1 -0
- package/dist/assert/type-number/type-number.match.js +8 -0
- package/dist/assert/type-number/type-number.match.js.map +1 -0
- package/dist/assert/type-number/type-number.test.d.ts +2 -0
- package/dist/assert/type-number/type-number.test.d.ts.map +1 -0
- package/dist/assert/type-number/type-number.test.js +82 -0
- package/dist/assert/type-number/type-number.test.js.map +1 -0
- package/dist/assert/type-numeric/type-numeric.assert.d.ts.map +1 -1
- package/dist/assert/type-numeric/type-numeric.assert.js +4 -2
- package/dist/assert/type-numeric/type-numeric.assert.js.map +1 -1
- package/dist/assert/type-numeric/type-numeric.match.d.ts +6 -0
- package/dist/assert/type-numeric/type-numeric.match.d.ts.map +1 -0
- package/dist/assert/type-numeric/type-numeric.match.js +8 -0
- package/dist/assert/type-numeric/type-numeric.match.js.map +1 -0
- package/dist/assert/type-numeric/type-numeric.test.d.ts +2 -0
- package/dist/assert/type-numeric/type-numeric.test.d.ts.map +1 -0
- package/dist/assert/type-numeric/type-numeric.test.js +96 -0
- package/dist/assert/type-numeric/type-numeric.test.js.map +1 -0
- package/dist/assert/type-object/type-object.assert.d.ts.map +1 -1
- package/dist/assert/type-object/type-object.assert.js +4 -2
- package/dist/assert/type-object/type-object.assert.js.map +1 -1
- package/dist/assert/type-object/type-object.match.d.ts +6 -0
- package/dist/assert/type-object/type-object.match.d.ts.map +1 -0
- package/dist/assert/type-object/type-object.match.js +8 -0
- package/dist/assert/type-object/type-object.match.js.map +1 -0
- package/dist/assert/type-object/type-object.test.d.ts +2 -0
- package/dist/assert/type-object/type-object.test.d.ts.map +1 -0
- package/dist/assert/type-object/type-object.test.js +71 -0
- package/dist/assert/type-object/type-object.test.js.map +1 -0
- package/dist/assert/type-string/type-string.assert.d.ts.map +1 -1
- package/dist/assert/type-string/type-string.assert.js +4 -2
- package/dist/assert/type-string/type-string.assert.js.map +1 -1
- package/dist/assert/type-string/type-string.match.d.ts +6 -0
- package/dist/assert/type-string/type-string.match.d.ts.map +1 -0
- package/dist/assert/type-string/type-string.match.js +8 -0
- package/dist/assert/type-string/type-string.match.js.map +1 -0
- package/dist/assert/type-string/type-string.test.d.ts +2 -0
- package/dist/assert/type-string/type-string.test.d.ts.map +1 -0
- package/dist/assert/type-string/type-string.test.js +62 -0
- package/dist/assert/type-string/type-string.test.js.map +1 -0
- package/dist/assert/type-typed-array/type-typed-array.assert.d.ts +1 -4
- package/dist/assert/type-typed-array/type-typed-array.assert.d.ts.map +1 -1
- package/dist/assert/type-typed-array/type-typed-array.assert.js +4 -2
- package/dist/assert/type-typed-array/type-typed-array.assert.js.map +1 -1
- package/dist/assert/type-typed-array/type-typed-array.match.d.ts +10 -0
- package/dist/assert/type-typed-array/type-typed-array.match.d.ts.map +1 -0
- package/dist/assert/type-typed-array/type-typed-array.match.js +8 -0
- package/dist/assert/type-typed-array/type-typed-array.match.js.map +1 -0
- package/dist/assert/type-typed-array/type-typed-array.test.d.ts +2 -0
- package/dist/assert/type-typed-array/type-typed-array.test.d.ts.map +1 -0
- package/dist/assert/type-typed-array/type-typed-array.test.js +173 -0
- package/dist/assert/type-typed-array/type-typed-array.test.js.map +1 -0
- package/dist/assert/typeof/typeof.test.d.ts +2 -0
- package/dist/assert/typeof/typeof.test.d.ts.map +1 -0
- package/dist/assert/typeof/typeof.test.js +61 -0
- package/dist/assert/typeof/typeof.test.js.map +1 -0
- package/dist/assert/undefined/undefined.test.d.ts +2 -0
- package/dist/assert/undefined/undefined.test.d.ts.map +1 -0
- package/dist/assert/undefined/undefined.test.js +45 -0
- package/dist/assert/undefined/undefined.test.js.map +1 -0
- package/dist/assert/uuid/uuid-v4.assert.d.ts +1 -3
- package/dist/assert/uuid/uuid-v4.assert.d.ts.map +1 -1
- package/dist/assert/uuid/uuid-v4.assert.js +4 -3
- package/dist/assert/uuid/uuid-v4.assert.js.map +1 -1
- package/dist/assert/uuid/uuid-v4.match.d.ts +8 -0
- package/dist/assert/uuid/uuid-v4.match.d.ts.map +1 -0
- package/dist/assert/uuid/uuid-v4.match.js +9 -0
- package/dist/assert/uuid/uuid-v4.match.js.map +1 -0
- package/dist/assert/uuid/uuid-v4.test.d.ts +2 -0
- package/dist/assert/uuid/uuid-v4.test.d.ts.map +1 -0
- package/dist/assert/uuid/uuid-v4.test.js +81 -0
- package/dist/assert/uuid/uuid-v4.test.js.map +1 -0
- package/dist/assertion-error.d.ts +0 -1
- package/dist/assertion-error.d.ts.map +1 -1
- package/dist/assertion-error.js +0 -1
- package/dist/assertion-error.js.map +1 -1
- package/dist/describe/describe.test.d.ts +2 -0
- package/dist/describe/describe.test.d.ts.map +1 -0
- package/dist/describe/describe.test.js +313 -0
- package/dist/describe/describe.test.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -1
- package/dist/match/match.d.ts +5 -0
- package/dist/match/match.d.ts.map +1 -1
- package/dist/match/match.js.map +1 -1
- package/package.json +11 -7
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { assertStringIncludes } from "./string-includes.assert.js";
|
|
3
|
+
import { stringIncluding } from "./string-includes.match.js";
|
|
4
|
+
import { desc, repr } from "../../describe/describe.js";
|
|
5
|
+
import { assertObjectMatches } from "../object-matches/object-matches.assert.js";
|
|
6
|
+
describe("string-includes", () => {
|
|
7
|
+
describe("assertStringIncludes", () => {
|
|
8
|
+
it("throws when string does not include substring", () => {
|
|
9
|
+
expect(() => {
|
|
10
|
+
assertStringIncludes("hello world", "foo");
|
|
11
|
+
}).toThrow('Expected string "hello world" to include "foo", but it did not.');
|
|
12
|
+
});
|
|
13
|
+
it("does not throw when string includes substring", () => {
|
|
14
|
+
expect(() => {
|
|
15
|
+
assertStringIncludes("hello world", "world");
|
|
16
|
+
}).not.toThrow();
|
|
17
|
+
});
|
|
18
|
+
it("throws with custom message", () => {
|
|
19
|
+
expect(() => {
|
|
20
|
+
assertStringIncludes("hello", "goodbye", "Custom error message");
|
|
21
|
+
}).toThrow("Custom error message");
|
|
22
|
+
});
|
|
23
|
+
it("works with empty substring", () => {
|
|
24
|
+
expect(() => {
|
|
25
|
+
assertStringIncludes("hello", "");
|
|
26
|
+
}).not.toThrow();
|
|
27
|
+
});
|
|
28
|
+
it("is case sensitive", () => {
|
|
29
|
+
expect(() => {
|
|
30
|
+
assertStringIncludes("Hello World", "hello");
|
|
31
|
+
}).toThrow('Expected string "Hello World" to include "hello", but it did not.');
|
|
32
|
+
});
|
|
33
|
+
it("works with substring at start", () => {
|
|
34
|
+
expect(() => {
|
|
35
|
+
assertStringIncludes("hello world", "hello");
|
|
36
|
+
}).not.toThrow();
|
|
37
|
+
});
|
|
38
|
+
it("works with substring at end", () => {
|
|
39
|
+
expect(() => {
|
|
40
|
+
assertStringIncludes("hello world", "world");
|
|
41
|
+
}).not.toThrow();
|
|
42
|
+
});
|
|
43
|
+
it("works with substring in middle", () => {
|
|
44
|
+
expect(() => {
|
|
45
|
+
assertStringIncludes("hello world", "o w");
|
|
46
|
+
}).not.toThrow();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe("stringIncluding", () => {
|
|
50
|
+
it("works as composable matcher", () => {
|
|
51
|
+
function getFile() {
|
|
52
|
+
return {
|
|
53
|
+
name: "document",
|
|
54
|
+
content: "This is a document with keywords",
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const file = getFile();
|
|
58
|
+
assertObjectMatches(file, {
|
|
59
|
+
content: stringIncluding("keywords"),
|
|
60
|
+
});
|
|
61
|
+
// Null-chain operator ? is not required after type narrowing.
|
|
62
|
+
// TypeScript knows file.content is a string containing "keywords".
|
|
63
|
+
const content = file.content;
|
|
64
|
+
expect(content).toBeTypeOf("string");
|
|
65
|
+
expect(content.includes("keywords")).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
it("matches strings that include substring", () => {
|
|
68
|
+
const matcher = stringIncluding("world");
|
|
69
|
+
expect(matcher.matches("hello world")).toBe(true);
|
|
70
|
+
expect(matcher.matches("world")).toBe(true);
|
|
71
|
+
});
|
|
72
|
+
it("does not match strings that do not include substring", () => {
|
|
73
|
+
const matcher = stringIncluding("foo");
|
|
74
|
+
expect(matcher.matches("bar")).toBe(false);
|
|
75
|
+
});
|
|
76
|
+
it("works with empty substring", () => {
|
|
77
|
+
const matcher = stringIncluding("");
|
|
78
|
+
expect(matcher.matches("hello")).toBe(true);
|
|
79
|
+
expect(matcher.matches("")).toBe(true);
|
|
80
|
+
});
|
|
81
|
+
it("is case sensitive", () => {
|
|
82
|
+
const matcher = stringIncluding("hello");
|
|
83
|
+
expect(matcher.matches("Hello World")).toBe(false);
|
|
84
|
+
expect(matcher.matches("hello world")).toBe(true);
|
|
85
|
+
});
|
|
86
|
+
it("works with substring at start", () => {
|
|
87
|
+
const matcher = stringIncluding("hello");
|
|
88
|
+
expect(matcher.matches("hello world")).toBe(true);
|
|
89
|
+
});
|
|
90
|
+
it("works with substring at end", () => {
|
|
91
|
+
const matcher = stringIncluding("world");
|
|
92
|
+
expect(matcher.matches("hello world")).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
it("works with substring in middle", () => {
|
|
95
|
+
const matcher = stringIncluding("o w");
|
|
96
|
+
expect(matcher.matches("hello world")).toBe(true);
|
|
97
|
+
});
|
|
98
|
+
it("does not match non-string values", () => {
|
|
99
|
+
const matcher = stringIncluding("foo");
|
|
100
|
+
expect(matcher.matches(null)).toBe(false);
|
|
101
|
+
expect(matcher.matches(undefined)).toBe(false);
|
|
102
|
+
expect(matcher.matches(123)).toBe(false);
|
|
103
|
+
expect(matcher.matches(true)).toBe(false);
|
|
104
|
+
});
|
|
105
|
+
it("describes the matcher", () => {
|
|
106
|
+
const matcher = stringIncluding("foo");
|
|
107
|
+
expect(desc(matcher)).toBe('string including "foo"');
|
|
108
|
+
});
|
|
109
|
+
it("represents the matcher", () => {
|
|
110
|
+
const matcher = stringIncluding("foobar");
|
|
111
|
+
expect(repr(matcher)).toBe('"…foobar…"');
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=string-includes.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-includes.test.js","sourceRoot":"","sources":["../../../src/assert/string-includes/string-includes.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAEjF,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,CAAC,GAAG,EAAE;gBACV,oBAAoB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAC7C,CAAC,CAAC,CAAC,OAAO,CACR,iEAAiE,CAClE,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,CAAC,GAAG,EAAE;gBACV,oBAAoB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACpC,MAAM,CAAC,GAAG,EAAE;gBACV,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,sBAAsB,CAAC,CAAC;YACn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AC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC1C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACzC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;YAC/B,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;YAChC,MAAM,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;YAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AssertionMatcher } from "../../match/match.js";
|
|
1
|
+
import { type AssertionMatcher, type refinement } from "../../match/match.js";
|
|
2
2
|
export type StringOfLength<N extends number> = N extends 0 ? "" : N extends 1 ? string & {
|
|
3
3
|
length: 1;
|
|
4
4
|
0: string;
|
|
@@ -88,8 +88,11 @@ export type StringOfLength<N extends number> = N extends 0 ? "" : N extends 1 ?
|
|
|
88
88
|
9: string;
|
|
89
89
|
10: string;
|
|
90
90
|
};
|
|
91
|
+
export type StringOfLengthMatcher<N extends number> = AssertionMatcher<StringOfLength<N>> & {
|
|
92
|
+
readonly [refinement]?: (actual: unknown) => StringOfLength<N>;
|
|
93
|
+
};
|
|
91
94
|
/**
|
|
92
95
|
* Matcher for a string with exactly the expected length.
|
|
93
96
|
*/
|
|
94
|
-
export declare function stringOfLength<const N extends number>(expectedLength: N):
|
|
97
|
+
export declare function stringOfLength<const N extends number>(expectedLength: N): StringOfLengthMatcher<N>;
|
|
95
98
|
//# sourceMappingURL=string-length.match.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-length.match.d.ts","sourceRoot":"","sources":["../../../src/assert/string-length/string-length.match.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"string-length.match.d.ts","sourceRoot":"","sources":["../../../src/assert/string-length/string-length.match.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EAErB,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,CAAC,GACtD,EAAE,GACF,CAAC,SAAS,CAAC,GACT,MAAM,GAAG;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GACjC,CAAC,SAAS,CAAC,GACT,MAAM,GAAG;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5C,CAAC,SAAS,CAAC,GACT,MAAM,GAAG;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GACvD,CAAC,SAAS,CAAC,GACT,MAAM,GAAG;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IA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,CAAC,GAChB,qBAAqB,CAAC,CAAC,CAAC,CAO1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-length.match.js","sourceRoot":"","sources":["../../../src/assert/string-length/string-length.match.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"string-length.match.js","sourceRoot":"","sources":["../../../src/assert/string-length/string-length.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,GAEd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAsGlD;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,cAAiB;IAEjB,OAAO,aAAa,CAClB,CAAC,KAAK,EAA8B,EAAE,CACpC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,cAAc,EAC9D,GAAG,EAAE,CAAC,oBAAoB,IAAI,CAAC,cAAc,CAAC,EAAE,EAChD,GAAG,EAAE,CAAC,UAAU,IAAI,CAAC,cAAc,CAAC,GAAG,CACxC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-length.test.d.ts","sourceRoot":"","sources":["../../../src/assert/string-length/string-length.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { assertStringLength } from "./string-length.assert.js";
|
|
3
|
+
import { stringOfLength } from "./string-length.match.js";
|
|
4
|
+
import { desc, repr } from "../../describe/describe.js";
|
|
5
|
+
import { assertObjectMatches } from "../object-matches/object-matches.assert.js";
|
|
6
|
+
describe("string-length", () => {
|
|
7
|
+
describe("assertStringLength", () => {
|
|
8
|
+
it("does not throw when string has expected length", () => {
|
|
9
|
+
expect(() => {
|
|
10
|
+
assertStringLength("hello", 5);
|
|
11
|
+
}).not.toThrow();
|
|
12
|
+
});
|
|
13
|
+
it("throws when string has different length", () => {
|
|
14
|
+
expect(() => {
|
|
15
|
+
assertStringLength("hello", 3);
|
|
16
|
+
}).toThrow('Expected string "hello" to have length 3, but it had length 5.');
|
|
17
|
+
});
|
|
18
|
+
it("works with empty string", () => {
|
|
19
|
+
expect(() => {
|
|
20
|
+
assertStringLength("", 0);
|
|
21
|
+
}).not.toThrow();
|
|
22
|
+
});
|
|
23
|
+
it("throws when expecting non-zero length on empty string", () => {
|
|
24
|
+
expect(() => {
|
|
25
|
+
assertStringLength("", 1);
|
|
26
|
+
}).toThrow('Expected string "" to have length 1, but it had length 0.');
|
|
27
|
+
});
|
|
28
|
+
it("throws with custom message", () => {
|
|
29
|
+
expect(() => {
|
|
30
|
+
assertStringLength("hello", 2, "Custom error message");
|
|
31
|
+
}).toThrow("Custom error message");
|
|
32
|
+
});
|
|
33
|
+
it("works with single character", () => {
|
|
34
|
+
expect(() => {
|
|
35
|
+
assertStringLength("a", 1);
|
|
36
|
+
}).not.toThrow();
|
|
37
|
+
});
|
|
38
|
+
it("throws when expecting single character on multi-character string", () => {
|
|
39
|
+
expect(() => {
|
|
40
|
+
assertStringLength("hello", 1);
|
|
41
|
+
}).toThrow('Expected string "hello" to have length 1, but it had length 5.');
|
|
42
|
+
});
|
|
43
|
+
it("works with exact length match", () => {
|
|
44
|
+
expect(() => {
|
|
45
|
+
assertStringLength("test", 4);
|
|
46
|
+
}).not.toThrow();
|
|
47
|
+
});
|
|
48
|
+
it("counts characters correctly including unicode", () => {
|
|
49
|
+
// Note: JavaScript's .length counts UTF-16 code units, not visual characters
|
|
50
|
+
expect(() => {
|
|
51
|
+
assertStringLength("hi", 2);
|
|
52
|
+
}).not.toThrow();
|
|
53
|
+
});
|
|
54
|
+
it("works with large lengths", () => {
|
|
55
|
+
const longString = "a".repeat(1000);
|
|
56
|
+
expect(() => {
|
|
57
|
+
assertStringLength(longString, 1000);
|
|
58
|
+
}).not.toThrow();
|
|
59
|
+
});
|
|
60
|
+
it("throws when length differs for large strings", () => {
|
|
61
|
+
const longString = "a".repeat(1000);
|
|
62
|
+
expect(() => {
|
|
63
|
+
assertStringLength(longString, 999);
|
|
64
|
+
}).toThrow('Expected string "aaaaaaaaaa...aaaaaaaaaa" to have length 999, but it had length 1000.');
|
|
65
|
+
});
|
|
66
|
+
it("narrows type for safe indexing", () => {
|
|
67
|
+
const foo = "a".repeat(10);
|
|
68
|
+
assertStringLength(foo, 10);
|
|
69
|
+
const thirdChar = foo[2];
|
|
70
|
+
expect(thirdChar.indexOf("a")).toBe(0);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
describe("stringOfLength", () => {
|
|
74
|
+
it("works as composable matcher", () => {
|
|
75
|
+
function getUser() {
|
|
76
|
+
return { id: "user123", username: "FooUser" };
|
|
77
|
+
}
|
|
78
|
+
const user = getUser();
|
|
79
|
+
assertObjectMatches(user, {
|
|
80
|
+
username: stringOfLength(7),
|
|
81
|
+
});
|
|
82
|
+
// Null-chain operator ? is not required after type narrowing.
|
|
83
|
+
// TypeScript knows user.username is a string of exactly 7 characters.
|
|
84
|
+
const fourthChar = user.username[3];
|
|
85
|
+
const eighthChar = user.username[7];
|
|
86
|
+
expect(user.username).toHaveLength(7);
|
|
87
|
+
expect(fourthChar).toBeTypeOf("string");
|
|
88
|
+
expect(eighthChar).toBeUndefined();
|
|
89
|
+
});
|
|
90
|
+
it("matches strings with expected length", () => {
|
|
91
|
+
const matcher = stringOfLength(5);
|
|
92
|
+
expect(matcher.matches("hello")).toBe(true);
|
|
93
|
+
});
|
|
94
|
+
it("does not match strings with different length", () => {
|
|
95
|
+
const matcher = stringOfLength(3);
|
|
96
|
+
expect(matcher.matches("hello")).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
it("works with empty string", () => {
|
|
99
|
+
const matcher = stringOfLength(0);
|
|
100
|
+
expect(matcher.matches("")).toBe(true);
|
|
101
|
+
});
|
|
102
|
+
it("does not match non-empty string when expecting empty", () => {
|
|
103
|
+
const matcher = stringOfLength(0);
|
|
104
|
+
expect(matcher.matches("a")).toBe(false);
|
|
105
|
+
});
|
|
106
|
+
it("works with single character", () => {
|
|
107
|
+
const matcher = stringOfLength(1);
|
|
108
|
+
expect(matcher.matches("a")).toBe(true);
|
|
109
|
+
});
|
|
110
|
+
it("does not match multi-character when expecting single", () => {
|
|
111
|
+
const matcher = stringOfLength(1);
|
|
112
|
+
expect(matcher.matches("ab")).toBe(false);
|
|
113
|
+
});
|
|
114
|
+
it("works with large lengths", () => {
|
|
115
|
+
const longString = "a".repeat(1000);
|
|
116
|
+
const matcher = stringOfLength(1000);
|
|
117
|
+
expect(matcher.matches(longString)).toBe(true);
|
|
118
|
+
});
|
|
119
|
+
it("does not match when length differs for large strings", () => {
|
|
120
|
+
const longString = "a".repeat(1000);
|
|
121
|
+
const matcher = stringOfLength(999);
|
|
122
|
+
expect(matcher.matches(longString)).toBe(false);
|
|
123
|
+
});
|
|
124
|
+
it("does not match non-string values", () => {
|
|
125
|
+
const matcher = stringOfLength(5);
|
|
126
|
+
expect(matcher.matches(null)).toBe(false);
|
|
127
|
+
expect(matcher.matches(undefined)).toBe(false);
|
|
128
|
+
expect(matcher.matches(123)).toBe(false);
|
|
129
|
+
expect(matcher.matches(true)).toBe(false);
|
|
130
|
+
expect(matcher.matches({ length: 5 })).toBe(false);
|
|
131
|
+
});
|
|
132
|
+
it("describes the matcher", () => {
|
|
133
|
+
const matcher = stringOfLength(5);
|
|
134
|
+
expect(desc(matcher)).toBe("string of length 5");
|
|
135
|
+
});
|
|
136
|
+
it("represents the matcher", () => {
|
|
137
|
+
const matcher = stringOfLength(5);
|
|
138
|
+
expect(repr(matcher)).toBe("String(5)");
|
|
139
|
+
});
|
|
140
|
+
it("represents with zero length", () => {
|
|
141
|
+
const matcher = stringOfLength(0);
|
|
142
|
+
expect(repr(matcher)).toBe("String(0)");
|
|
143
|
+
});
|
|
144
|
+
it("works with unicode characters", () => {
|
|
145
|
+
// JavaScript's .length counts UTF-16 code units
|
|
146
|
+
const matcher = stringOfLength(2);
|
|
147
|
+
expect(matcher.matches("你好")).toBe(true);
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
//# sourceMappingURL=string-length.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-length.test.js","sourceRoot":"","sources":["../../../src/assert/string-length/string-length.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAEjF,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,EAAE,CAAC,gDAAgD,EAAE,GAAG,EAAE;YACxD,MAAM,CAAC,GAAG,EAAE;gBACV,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;YACjD,MAAM,CAAC,GAAG,EAAE;gBACV,kBAAkB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC,OAAO,CACR,gEAAgE,CACjE,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;YACjC,MAAM,CAAC,GAAG,EAAE;gBACV,kBAAkB,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;YAC5B,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,EAA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,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-not-includes.test.d.ts","sourceRoot":"","sources":["../../../src/assert/string-not-includes/string-not-includes.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { assertStringNotIncludes } from "./string-not-includes.assert.js";
|
|
3
|
+
import { desc, repr } from "../../describe/describe.js";
|
|
4
|
+
import { stringNotIncluding } from "./string-not-includes.match.js";
|
|
5
|
+
import { assertObjectMatches } from "../object-matches/object-matches.assert.js";
|
|
6
|
+
describe("string-not-includes", () => {
|
|
7
|
+
describe("assertStringNotIncludes", () => {
|
|
8
|
+
it("throws when string includes substring", () => {
|
|
9
|
+
expect(() => {
|
|
10
|
+
assertStringNotIncludes("hello world", "world");
|
|
11
|
+
}).toThrow('Expected string "hello world" not to include "world", but it did.');
|
|
12
|
+
});
|
|
13
|
+
it("does not throw when string does not include substring", () => {
|
|
14
|
+
expect(() => {
|
|
15
|
+
assertStringNotIncludes("hello world", "foo");
|
|
16
|
+
}).not.toThrow();
|
|
17
|
+
});
|
|
18
|
+
it("throws with custom message", () => {
|
|
19
|
+
expect(() => {
|
|
20
|
+
assertStringNotIncludes("hello", "ell", "Custom error message");
|
|
21
|
+
}).toThrow("Custom error message");
|
|
22
|
+
});
|
|
23
|
+
it("throws with empty substring", () => {
|
|
24
|
+
expect(() => {
|
|
25
|
+
assertStringNotIncludes("hello", "");
|
|
26
|
+
}).toThrow('Expected string "hello" not to include "", but it did.');
|
|
27
|
+
});
|
|
28
|
+
it("is case sensitive", () => {
|
|
29
|
+
expect(() => {
|
|
30
|
+
assertStringNotIncludes("Hello World", "hello");
|
|
31
|
+
}).not.toThrow();
|
|
32
|
+
});
|
|
33
|
+
it("throws with substring at start", () => {
|
|
34
|
+
expect(() => {
|
|
35
|
+
assertStringNotIncludes("hello world", "hello");
|
|
36
|
+
}).toThrow('Expected string "hello world" not to include "hello", but it did.');
|
|
37
|
+
});
|
|
38
|
+
it("throws with substring at end", () => {
|
|
39
|
+
expect(() => {
|
|
40
|
+
assertStringNotIncludes("hello world", "world");
|
|
41
|
+
}).toThrow('Expected string "hello world" not to include "world", but it did.');
|
|
42
|
+
});
|
|
43
|
+
it("throws with substring in middle", () => {
|
|
44
|
+
expect(() => {
|
|
45
|
+
assertStringNotIncludes("hello world", "o w");
|
|
46
|
+
}).toThrow('Expected string "hello world" not to include "o w", but it did.');
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
describe("stringNotIncluding", () => {
|
|
50
|
+
it("works as composable matcher", () => {
|
|
51
|
+
function getConfig() {
|
|
52
|
+
return {
|
|
53
|
+
filename: "config.json",
|
|
54
|
+
options: { flag: "--debug" },
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const config = getConfig();
|
|
58
|
+
assertObjectMatches(config, {
|
|
59
|
+
options: { flag: stringNotIncluding("error") },
|
|
60
|
+
});
|
|
61
|
+
// Null-chain operator ? is not required after type narrowing.
|
|
62
|
+
// TypeScript knows config.options.flag is a string.
|
|
63
|
+
const flag = config.options.flag;
|
|
64
|
+
expect(flag).toBeTypeOf("string");
|
|
65
|
+
expect(flag.includes("error")).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
it("matches strings that do not include substring", () => {
|
|
68
|
+
const matcher = stringNotIncluding("world");
|
|
69
|
+
expect(matcher.matches("hello")).toBe(true);
|
|
70
|
+
});
|
|
71
|
+
it("does not match strings that include substring", () => {
|
|
72
|
+
const matcher = stringNotIncluding("world");
|
|
73
|
+
expect(matcher.matches("hello world")).toBe(false);
|
|
74
|
+
});
|
|
75
|
+
it("does not match empty string with non-empty substring", () => {
|
|
76
|
+
const matcher = stringNotIncluding("world");
|
|
77
|
+
expect(matcher.matches("")).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
it("does not match when string equals substring", () => {
|
|
80
|
+
const matcher = stringNotIncluding("world");
|
|
81
|
+
expect(matcher.matches("world")).toBe(false);
|
|
82
|
+
});
|
|
83
|
+
it("works with empty substring", () => {
|
|
84
|
+
const matcher = stringNotIncluding("");
|
|
85
|
+
expect(matcher.matches("hello")).toBe(false);
|
|
86
|
+
expect(matcher.matches("")).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
it("is case sensitive", () => {
|
|
89
|
+
const matcher = stringNotIncluding("hello");
|
|
90
|
+
expect(matcher.matches("Hello World")).toBe(true);
|
|
91
|
+
expect(matcher.matches("hello world")).toBe(false);
|
|
92
|
+
});
|
|
93
|
+
it("works with substring at start", () => {
|
|
94
|
+
const matcher = stringNotIncluding("hello");
|
|
95
|
+
expect(matcher.matches("hello world")).toBe(false);
|
|
96
|
+
expect(matcher.matches("world hello")).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
it("works with substring at end", () => {
|
|
99
|
+
const matcher = stringNotIncluding("world");
|
|
100
|
+
expect(matcher.matches("hello world")).toBe(false);
|
|
101
|
+
expect(matcher.matches("world hello")).toBe(false);
|
|
102
|
+
});
|
|
103
|
+
it("does not match non-string values", () => {
|
|
104
|
+
const matcher = stringNotIncluding("foo");
|
|
105
|
+
expect(matcher.matches(null)).toBe(false);
|
|
106
|
+
expect(matcher.matches(undefined)).toBe(false);
|
|
107
|
+
expect(matcher.matches(123)).toBe(false);
|
|
108
|
+
expect(matcher.matches(true)).toBe(false);
|
|
109
|
+
});
|
|
110
|
+
it("describes the matcher", () => {
|
|
111
|
+
const matcher = stringNotIncluding("foo");
|
|
112
|
+
expect(desc(matcher)).toBe('string not including "foo"');
|
|
113
|
+
});
|
|
114
|
+
it("represents the matcher", () => {
|
|
115
|
+
const matcher = stringNotIncluding("foobar");
|
|
116
|
+
expect(repr(matcher)).toBe('"✗foobar✗"');
|
|
117
|
+
});
|
|
118
|
+
it("represents with special characters", () => {
|
|
119
|
+
const matcher = stringNotIncluding(".");
|
|
120
|
+
expect(repr(matcher)).toBe('"✗.✗"');
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
//# sourceMappingURL=string-not-includes.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-not-includes.test.js","sourceRoot":"","sources":["../../../src/assert/string-not-includes/string-not-includes.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAEjF,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,QAAQ,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACvC,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,CAAC,GAAG,EAAE;gBACV,uBAAuB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAClD,CAAC,CAAC,CAAC,OAAO,CACR,mEAAmE,CACpE,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;YAC/D,MAAM,CAAC,GAAG,EAAE;gBACV,uBAAuB,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;YACpC,MAAM,CAAC,GAAG,EAAE;gBACV,uBAAuB,CAAC,OAAO,EAAE,KAAK,EAA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,CAAC;QAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;YAC5C,MAAM,OAAO,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-starts-with.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/string-starts-with/string-starts-with.assert.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"string-starts-with.assert.d.ts","sourceRoot":"","sources":["../../../src/assert/string-starts-with/string-starts-with.assert.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAC3D,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,EACT,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,KAAK,IAAI,GAAG,CAAC,GAAG,MAAM,EAAE,CAUlC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { AssertionError } from "../../assertion-error.js";
|
|
2
2
|
import { desc, repr } from "../../describe/describe.js";
|
|
3
|
+
import { stringStartingWith } from "./string-starts-with.match.js";
|
|
3
4
|
/**
|
|
4
5
|
* Assert that a string starts with a given prefix, with type narrowing.
|
|
5
6
|
*/
|
|
6
7
|
export function assertStringStartsWith(value, prefix, message) {
|
|
7
|
-
|
|
8
|
+
const matcher = stringStartingWith(prefix);
|
|
9
|
+
if (!matcher.matches(value)) {
|
|
8
10
|
throw new AssertionError(message ??
|
|
9
|
-
`Expected ${desc(value)} to start with ${repr(prefix)}, but it did not.`, value,
|
|
11
|
+
`Expected ${desc(value)} to start with ${repr(prefix)}, but it did not.`, value, matcher.represent());
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=string-starts-with.assert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string-starts-with.assert.js","sourceRoot":"","sources":["../../../src/assert/string-starts-with/string-starts-with.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"string-starts-with.assert.js","sourceRoot":"","sources":["../../../src/assert/string-starts-with/string-starts-with.assert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,KAAa,EACb,MAAS,EACT,OAAgB;IAEhB,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,cAAc,CACtB,OAAO;YACL,YAAY,IAAI,CAAC,KAAK,CAAC,kBAAkB,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAC1E,KAAK,EACL,OAAO,CAAC,SAAS,EAAE,CACpB,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type AssertionMatcher } from "../../match/match.js";
|
|
2
|
+
/**
|
|
3
|
+
* Matcher for a string that starts with a given prefix.
|
|
4
|
+
*/
|
|
5
|
+
export declare function stringStartingWith<const T extends string>(prefix: T): AssertionMatcher<`${T}${string}`>;
|
|
6
|
+
//# sourceMappingURL=string-starts-with.match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-starts-with.match.d.ts","sourceRoot":"","sources":["../../../src/assert/string-starts-with/string-starts-with.match.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EACvD,MAAM,EAAE,CAAC,GACR,gBAAgB,CAAC,GAAG,CAAC,GAAG,MAAM,EAAE,CAAC,CAOnC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { repr } from "../../describe/describe.js";
|
|
2
|
+
import { createMatcher } from "../../match/match.js";
|
|
3
|
+
/**
|
|
4
|
+
* Matcher for a string that starts with a given prefix.
|
|
5
|
+
*/
|
|
6
|
+
export function stringStartingWith(prefix) {
|
|
7
|
+
return createMatcher((value) => typeof value === "string" && value.startsWith(prefix), () => `string starting with ${repr(prefix)}`, () => `"${prefix}…"`);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=string-starts-with.match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-starts-with.match.js","sourceRoot":"","sources":["../../../src/assert/string-starts-with/string-starts-with.match.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAClD,OAAO,EAAyB,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE5E;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAS;IAET,OAAO,aAAa,CAClB,CAAC,KAAK,EAA4B,EAAE,CAClC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EACvD,GAAG,EAAE,CAAC,wBAAwB,IAAI,CAAC,MAAM,CAAC,EAAE,EAC5C,GAAG,EAAE,CAAC,IAAI,MAAM,IAAI,CACrB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string-starts-with.test.d.ts","sourceRoot":"","sources":["../../../src/assert/string-starts-with/string-starts-with.test.ts"],"names":[],"mappings":""}
|