@sprucelabs/test-utils 5.0.91 → 5.1.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.
@@ -41,6 +41,8 @@ export interface ISpruceAssert {
41
41
  doesThrow(cb: () => any, matcher?: string | RegExp | undefined, msg?: string | undefined): Error;
42
42
  doesThrowAsync(cb: () => any | Promise<any>, matcher?: string | RegExp | undefined, msg?: string | undefined): Promise<Error>;
43
43
  fail(message?: string): void;
44
+ isBetween(actual: number, floor: number, ceiling: number, message?: string): void;
45
+ isBetweenInclusive(actual: number, floor: number, ceiling: number, message?: string): void;
44
46
  }
45
47
  declare const assert: ISpruceAssert;
46
48
  export default assert;
@@ -228,5 +228,15 @@ const assert = {
228
228
  isInstanceOf(actual, Class) {
229
229
  assert.isTrue(actual instanceof Class, `${assert_utility_1.default.stringify(actual)} is not an instance of:\n\n${Class}`);
230
230
  },
231
+ isBetween(actual, floor, ceiling, message) {
232
+ assert.isBelow(actual, ceiling, message);
233
+ assert.isAbove(actual, floor, message);
234
+ },
235
+ isBetweenInclusive(actual, floor, ceiling, message) {
236
+ if (actual >= floor && actual <= ceiling) {
237
+ return;
238
+ }
239
+ assert.fail(message !== null && message !== void 0 ? message : `${actual} is not between ${floor} and ${ceiling} (inclusive)`);
240
+ },
231
241
  };
232
242
  exports.default = assert;
@@ -41,6 +41,8 @@ export interface ISpruceAssert {
41
41
  doesThrow(cb: () => any, matcher?: string | RegExp | undefined, msg?: string | undefined): Error;
42
42
  doesThrowAsync(cb: () => any | Promise<any>, matcher?: string | RegExp | undefined, msg?: string | undefined): Promise<Error>;
43
43
  fail(message?: string): void;
44
+ isBetween(actual: number, floor: number, ceiling: number, message?: string): void;
45
+ isBetweenInclusive(actual: number, floor: number, ceiling: number, message?: string): void;
44
46
  }
45
47
  declare const assert: ISpruceAssert;
46
48
  export default assert;
@@ -234,5 +234,15 @@ const assert = {
234
234
  isInstanceOf(actual, Class) {
235
235
  assert.isTrue(actual instanceof Class, `${assertUtil.stringify(actual)} is not an instance of:\n\n${Class}`);
236
236
  },
237
+ isBetween(actual, floor, ceiling, message) {
238
+ assert.isBelow(actual, ceiling, message);
239
+ assert.isAbove(actual, floor, message);
240
+ },
241
+ isBetweenInclusive(actual, floor, ceiling, message) {
242
+ if (actual >= floor && actual <= ceiling) {
243
+ return;
244
+ }
245
+ assert.fail(message !== null && message !== void 0 ? message : `${actual} is not between ${floor} and ${ceiling} (inclusive)`);
246
+ },
237
247
  };
238
248
  export default assert;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "5.0.91",
6
+ "version": "5.1.0",
7
7
  "files": [
8
8
  "build"
9
9
  ],