chai-bites 0.2.0 → 0.3.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/index.d.ts +1 -1
- package/index.js +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
|
|
15
|
+
equalBytes(bytes?: string | ArrayLike<number>, msg?: string): Assertion;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface Assert {
|
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.
|
|
3
|
+
"version": "0.3.0",
|
|
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"
|