diff options
| author | Tobias Nießen <tniessen@tnie.de> | 2021-08-12 22:24:24 +0200 |
|---|---|---|
| committer | James M Snell <jasnell@gmail.com> | 2021-08-15 11:10:12 -0700 |
| commit | fdce138e1dd86f63f141cbd5ec6b670eeec68986 (patch) | |
| tree | 8f786981e1adfccbfeaa33fdf82e99efd4074bc2 /test/parallel/test-policy-crypto-default-encoding.js | |
| parent | b24ab473d51d7bd9b781b0ef52c940089087a799 (diff) | |
| download | node-new-test.tar.gz | |
policy: fix integrity when DEFAULT_ENCODING is settest
PR-URL: https://github.com/nodejs/node/pull/39750
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-policy-crypto-default-encoding.js')
| -rw-r--r-- | test/parallel/test-policy-crypto-default-encoding.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/parallel/test-policy-crypto-default-encoding.js b/test/parallel/test-policy-crypto-default-encoding.js new file mode 100644 index 0000000000..1f62b4d85a --- /dev/null +++ b/test/parallel/test-policy-crypto-default-encoding.js @@ -0,0 +1,34 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); +common.requireNoPackageJSONAbove(); + +const fixtures = require('../common/fixtures'); + +const assert = require('assert'); +const { spawnSync } = require('child_process'); + +const encodings = ['buffer', 'utf8', 'utf16le', 'latin1', 'base64', 'hex']; + +for (const encoding of encodings) { + const dep = fixtures.path('policy', 'crypto-default-encoding', 'parent.js'); + const depPolicy = fixtures.path( + 'policy', + 'crypto-default-encoding', + 'policy.json'); + const { status } = spawnSync( + process.execPath, + [ + '--experimental-policy', depPolicy, dep, + ], + { + env: { + ...process.env, + DEFAULT_ENCODING: encoding + } + } + ); + assert.strictEqual(status, 0); +} |
