1// Flags: --expose-internals
2'use strict';
3
4const common = require('../common');
5if (!common.hasCrypto)
6  common.skip('missing crypto');
7
8const assert = require('assert');
9
10const {
11  normalizeAlgorithm,
12} = require('internal/crypto/util');
13
14{
15  // Check that normalizeAlgorithm does not mutate object inputs.
16  const algorithm = { name: 'ECDSA', hash: 'SHA-256' };
17  assert.strictEqual(normalizeAlgorithm(algorithm, 'sign') !== algorithm, true);
18  assert.deepStrictEqual(algorithm, { name: 'ECDSA', hash: 'SHA-256' });
19}
20