We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 323c91b commit fde0915Copy full SHA for fde0915
test/unit/utils/crypto-util_test.js
@@ -0,0 +1,18 @@
1
+const cryptoUtil = require('../../../lib/utils/crypto-util');
2
+require('chai').should();
3
+
4
+describe(cryptoUtil.createHash.name, function () {
5
+ it('creates a hash by given algorithm', function () {
6
+ const data = 'client-credentials-grant';
7
+ const hash = cryptoUtil.createHash({ data, encoding: 'hex' });
8
+ hash.should.equal('072726830f0aadd2d91f86f53e3a7ef40018c2626438152dd576e272bf2b8e60');
9
+ });
10
+ it('should throw if data is missing', function () {
11
+ try {
12
+ cryptoUtil.createHash({});
13
+ } catch (e) {
14
+ e.should.be.instanceOf(TypeError);
15
+ e.message.should.include('he "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.');
16
+ }
17
18
+});
0 commit comments