Skip to content

Commit fa1afe0

Browse files
committed
test [PERJ]: assert on a distinctive secret value, not 'tok' (a checkout path containing it made the stack match)
1 parent 07fbac4 commit fa1afe0

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎components/pryv/test/PryvError.test.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,14 @@ describe('[PERX] PryvError', function () {
7373
});
7474

7575
it('[PERJ] innerObject and response are readable but not enumerable (not printed with the error)', function () {
76-
const error = new PryvError('Outer', { id: 'invalid-access-token', secret: 'tok' });
77-
error.response = { body: { secret: 'tok' }, status: 401 };
76+
// A value no stack trace can contain (the stack holds the checkout path).
77+
const secret = 'perj-inner-secret-9c41';
78+
const error = new PryvError('Outer', { id: 'invalid-access-token', secret });
79+
error.response = { body: { secret }, status: 401 };
7880
expect(error.innerObject.id).to.equal('invalid-access-token');
7981
expect(error.response.status).to.equal(401);
8082
expect(Object.keys(error)).to.not.include('innerObject');
8183
expect(Object.keys(error)).to.not.include('response');
82-
expect(require('util').inspect(error)).to.not.include('tok');
84+
expect(require('util').inspect(error)).to.not.include(secret);
8385
});
8486
});

0 commit comments

Comments
 (0)