const decryptedResult = await mb.unpack(encryptedResult);
assert.deepStrictEqual(decryptedResult, object);
});
+
+ it('handles undefined', async function () {
+ try {
+ await mb.unpack();
+ assert.fail(noExpectedException);
+ } catch (e) {
+ assert(e instanceof RangeError, noExpectedException);
+ }
+ });
+
+ it('handles incomplete', async function () {
+ const encryptedResult = await mb.pack({ foo: 'bar' });
+ try {
+ await mb.unpack(encryptedResult.slice(0, 6));
+ assert.fail(noExpectedException);
+ } catch (e) {
+ assert(e instanceof RangeError, noExpectedException);
+ }
+ });
+
}); // pack, unpack
}); // MysteryBox
\ No newline at end of file