Skip to content

Commit

Permalink
chore: vary expectation depending on node version
Browse files Browse the repository at this point in the history
  • Loading branch information
Marsup committed Jan 16, 2024
1 parent b152afb commit e243197
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@
]
},
"dependencies": {
"@hapi/hoek": "^11.0.2",
"@hapi/b64": "^6.0.1",
"@hapi/boom": "^10.0.1",
"@hapi/bourne": "^3.0.0",
"@hapi/cryptiles": "^6.0.1"
"@hapi/cryptiles": "^6.0.1",
"@hapi/hoek": "^11.0.4"
},
"devDependencies": {
"@hapi/code": "^9.0.3",
"@hapi/eslint-plugin": "*",
"@hapi/lab": "^25.1.2",
"@types/node": "^17.0.31",
"@hapi/lab": "^25.2.0",
"@hapi/somever": "^4.1.1",
"@types/node": "^18.19.7",
"typescript": "~4.6.4"
},
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const B64 = require('@hapi/b64');
const Code = require('@hapi/code');
const Cryptiles = require('@hapi/cryptiles');
const Hoek = require('@hapi/hoek');
const Somever = require('@hapi/somever');
const Iron = require('..');
const Lab = require('@hapi/lab');

Expand Down Expand Up @@ -352,7 +353,11 @@ describe('Iron', () => {
const macBaseString = Iron.macPrefix + '**' + key.salt + '*' + iv + '*' + encryptedB64 + '*';
const mac = await Iron.hmacWithPassword(password, Iron.defaults.integrity, macBaseString);
const ticket = macBaseString + '*' + mac.salt + '*' + mac.digest;
const err = await expect(Iron.unseal(ticket, password, Iron.defaults)).to.reject(/Failed parsing sealed object JSON: Unexpected token a/);
const err = await expect(Iron.unseal(ticket, password, Iron.defaults)).to.reject(
Somever.match(process.version, '>=20') ?
/Failed parsing sealed object JSON: Expected property name or '}' in JSON at position 1/ :
/Failed parsing sealed object JSON: Unexpected token a/
);
expect(err.isBoom).to.be.true();
});

Expand Down

0 comments on commit e243197

Please sign in to comment.