Skip to content

Commit d82f066

Browse files
refactor(TestingToBeMatchers): separate parameters from range and length.
1 parent bd4dfb3 commit d82f066

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

src/lib/testing-tobe-matchers.class.ts

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ export class TestingToBeMatchers extends TestingExpect {
269269
* `isNumberBetween()` function from the `@angular-package/type`.
270270
* @param value The value of any type that is checked against a `number` type or an instance of a `Number` within the specified `range`
271271
* and the result of its check is passed to the `expect()` function of jasmine.
272-
* @param range An `object` of optional minimum and maximum `range` of a given `value`.
272+
* @param min The **minimum** range of generic type variable `Min` of the given `value`.
273+
* @param max The **maximum** range of generic type variable `Max` of the given `value`.
273274
* @param expected The expected `value` of a `boolean` to compare against the result of the `value` check that is passed to the `toBe()`
274275
* method of `jasmine.Matchers`.
275276
* @param expectationFailOutput An additional message when the matcher fails, by default, states the `value` should be (or not) a `number`
@@ -278,15 +279,18 @@ export class TestingToBeMatchers extends TestingExpect {
278279
*/
279280
public numberBetween<Min extends number, Max extends number>(
280281
value: any,
281-
range: MinMax<Min, Max>,
282+
min: Min,
283+
max: Max,
282284
expected: jasmine.Expected<boolean> = true,
283285
expectationFailOutput: any = `${this.expectationFailOutput} ${
284286
this.getNot() === true ? `not` : ``
285-
} be a \`number\` type or an instance of a \`Number\` between the range of ${
286-
range?.min
287-
} and ${range?.max}`
287+
} be a \`number\` type or an instance of a \`Number\` between the range of ${min} and ${max}`
288288
): this {
289-
this.toBe(is.numberBetween(value, range), expected, expectationFailOutput);
289+
this.toBe(
290+
is.numberBetween(value, min, max),
291+
expected,
292+
expectationFailOutput
293+
);
290294
return this;
291295
}
292296

@@ -536,6 +540,8 @@ export class TestingToBeMatchers extends TestingExpect {
536540
* method uses `isStringLength()` function from the `@angular-package/type`.
537541
* @param value The value of any type that is checked against a `string` type or an instance of a `String` of the specified `length` and
538542
* the result of its check is passed to the `expect()` function of jasmine.
543+
* @param min The **minimum** length of generic type variable `Min` of the given `value`.
544+
* @param max The **maximum** length of generic type variable `Max` of the given `value`.
539545
* @param length An `object` of optional minimum and maximum `length` of the given `value`.
540546
* @param expected The expected `value` of a `boolean` to compare against the result of the `value` check that is passed to the `toBe()`
541547
* method of `jasmine.Matchers`.
@@ -545,15 +551,18 @@ export class TestingToBeMatchers extends TestingExpect {
545551
*/
546552
public stringOfLength<Min extends number, Max extends number>(
547553
value: any,
548-
length: MinMax<Min, Max>,
554+
min: Min,
555+
max: Max,
549556
expected: jasmine.Expected<boolean> = true,
550557
expectationFailOutput: any = `${this.expectationFailOutput} ${
551558
this.getNot() === true ? `not` : ``
552-
} be a \`string\` type or an instance of a \`String\` of the \`length\` between the given ${
553-
length?.min
554-
} and ${length?.max}`
559+
} be a \`string\` type or an instance of a \`String\` of the \`length\` between the given ${min} and ${max}`
555560
): this {
556-
this.toBe(is.stringLength(value, length), expected, expectationFailOutput);
561+
this.toBe(
562+
is.stringLength(value, min, max),
563+
expected,
564+
expectationFailOutput
565+
);
557566
return this;
558567
}
559568

0 commit comments

Comments
 (0)