chai-bites 0.2.0 → 0.3.1

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.
Files changed (3) hide show
  1. package/index.d.ts +3 -3
  2. package/index.js +3 -3
  3. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -12,7 +12,7 @@ declare global {
12
12
  * expect(new Uint8Array([1, 2])).to.equalBytes([1, 2]);
13
13
  * expect(new Uint8Array[65, 66, 67])).to.equalBytes('414243');
14
14
  */
15
- equalBytes(bytes?: string | ArrayLike<number>): Assertion;
15
+ equalBytes(bytes?: string | ArrayLike<number>, msg?: string): Assertion;
16
16
  }
17
17
 
18
18
  interface Assert {
@@ -27,10 +27,10 @@ declare global {
27
27
  * Assert.equalBytes(new Uint8Array(3), [0, 0, 0]);
28
28
  * Assert.equalBytes(new Uint8Array(2), '0000');
29
29
  */
30
- equalBytes(buffer?: Uint8Array, bytes?: string | ArrayLike<number>, msg?: string): void;
30
+ equalBytes(buffer?: string | ArrayLike<number>, bytes?: string | ArrayLike<number>, msg?: string): void;
31
31
  }
32
32
  }
33
33
  }
34
34
 
35
35
  declare function chaiBytes(chai: any): any;
36
- export = chaiBytes;
36
+ export default chaiBytes;
package/index.js CHANGED
@@ -21,7 +21,7 @@ function every (buffer, predicate) {
21
21
  export default function (chai) {
22
22
  const Assertion = chai.Assertion;
23
23
 
24
- Assertion.addMethod('equalBytes', function (expected) {
24
+ Assertion.addMethod('equalBytes', function (expected, message) {
25
25
  if (typeof expected === 'string') {
26
26
  if (expected.length % 2 !== 0 || !/^[0-9a-f]*$/i.test(expected)) {
27
27
  throw new TypeError('Invalid hex string: ' + expected);
@@ -48,8 +48,8 @@ export default function (chai) {
48
48
 
49
49
  this.assert(
50
50
  assert,
51
- 'expected #{this} to equal #{exp}',
52
- 'expected #{this} to not equal #{exp}',
51
+ message ?? 'expected #{this} to equal #{exp}',
52
+ message ?? 'expected #{this} to not equal #{exp}',
53
53
  expected
54
54
  );
55
55
  });
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "chai-bites",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Chai assertions for byte arrays equality",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/achingbrain/chai-bites.git"
7
+ "url": "git+https://github.com/achingbrain/chai-bites.git"
8
8
  },
9
9
  "bugs": {
10
10
  "url": "https://github.com/achingbrain/chai-bites/issues"