This commit is contained in:
Shashank Tomar 2017-10-20 16:11:45 +05:30
Родитель 3aeba38d02
Коммит d0199d6d8e
4 изменённых файлов: 11 добавлений и 11 удалений

Просмотреть файл

@ -8,7 +8,7 @@ describe('Util', () => {
time="2015-04-17T21:43:47-04:00" level="debug" msg="executing: /usr/bin/VBoxManage showvminfo dev2 --machinereadable"`;
expect(util.removeSensitiveData(testdata).indexOf('CERTIFICATE')).toEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('nX5Vh1bslYJzsSdBNZFWSKShZ+gtRpjtV7NynANDJPQNIRhDxAf4uDY9hA2c')).toEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('<redacted>')).toNotEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('<redacted>')).not.toEqual(-1);
});
it('filters ssh private key data', () => {
@ -17,23 +17,23 @@ describe('Util', () => {
time="2015-04-17T21:43:47-04:00" level="debug" msg="executing: ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectionAttempts=30 -o LogLevel=quiet -p 50483 -i /Users/johnappleseed/.docker/machine/machines/dev2/id_rsa docker@localhost echo \"-----BEGIN CERTIFICATE-----\nMIIC+DCCAeKgAwIBAgIRANfIbsa2M94gDY+fBiBiQBkwCwYJKoZIhvcNAQELMBIx\nEDAOBg`;
expect(util.removeSensitiveData(testdata).indexOf('PRIVATE')).toEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('94fYH4W1Fq0uDJ9kZ7oItLyF5EPaLlY9E8+YuJBl0OSTtdicROUv')).toEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('<redacted>')).toNotEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('<redacted>')).not.toEqual(-1);
});
it('filters username data', () => {
var testdata = String.raw`/Users/johnappleseed/.docker/machine/machines/dev2/id_rsa docker@localhost echo`;
expect(util.removeSensitiveData(testdata).indexOf('/Users/johnappleseed/')).toEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/')).toNotEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/')).not.toEqual(-1);
testdata = String.raw`/Users/some.wei-rdUsername/.docker/machine/machines/dev2/id_rsa docker@localhost echo`;
expect(util.removeSensitiveData(testdata).indexOf('/Users/some.wei-rdUsername/.docker')).toEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/.docker')).toNotEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('/Users/<redacted>/.docker')).not.toEqual(-1);
});
it('filters Windows username data', () => {
var testdata = String.raw`C:\\Users\\johnappleseed\\.docker\\machine`;
expect(util.removeSensitiveData(testdata).indexOf('johnappleseed')).toEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('<redacted>')).toNotEqual(-1);
expect(util.removeSensitiveData(testdata).indexOf('<redacted>')).not.toEqual(-1);
});
it ('returns input if empty or not a string', () => {

Просмотреть файл

@ -1,7 +1,7 @@
{
"testDirectoryName": "__integration__",
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"setupEnvScriptFile": "<rootDir>/util/testenv.js",
"testMatch": ["**/__integration__/**/*.js"],
"transform": {".*": "<rootDir>/node_modules/babel-jest"},
"setupFiles": ["<rootDir>/util/testenv.js"],
"setupTestFrameworkScriptFile": "<rootDir>/util/prepare.js",
"unmockedModulePathPatterns": [
"babel",

Просмотреть файл

@ -1,6 +1,6 @@
{
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"setupEnvScriptFile": "<rootDir>/util/testenv.js",
"transform": { ".*": "<rootDir>/node_modules/babel-jest" },
"setupFiles": ["<rootDir>/util/testenv.js"],
"setupTestFrameworkScriptFile": "<rootDir>/util/prepare.js",
"unmockedModulePathPatterns": [
"alt",

Просмотреть файл

@ -83,7 +83,7 @@
"grunt-rename": "^0.1.4",
"grunt-shell": "^1.1.2",
"grunt-shell-spawn": "^0.3.8",
"jest-cli": "^0.8.2",
"jest-cli": "^21.2.1",
"jsxhint": "^0.15.1",
"load-grunt-tasks": "^3.2.0",
"minimist": "^1.1.1",