Skip to content

Commit 6e38ec1

Browse files
author
Stefan-Gabriel Muscalu
committed
Update: should not duplicate fingerprint entries test reworked to look for duplicate lines not just the number of them
1 parent 2e93d80 commit 6e38ec1

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

test/internal/tls.test.js

+24-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,30 @@ describe('trust-on-first-use', function() {
167167
driver.session();
168168

169169
setTimeout(function() {
170-
expect( fs.readFileSync(knownHostsPath, 'utf8').trim().split('\n').length ).toBe( 1 );
170+
var lines = {};
171+
fs.readFileSync(knownHostsPath, 'utf8')
172+
.split('\n')
173+
.filter(function(line) {
174+
return !! (line.trim());
175+
})
176+
.forEach(function(line) {
177+
if (!lines[line]) {
178+
lines[line] = 0;
179+
}
180+
lines[line]++;
181+
});
182+
183+
var duplicatedLines = Object
184+
.keys(lines)
185+
.map(function(line) {
186+
return lines[line];
187+
})
188+
.filter(function(count) {
189+
return count > 1;
190+
})
191+
.length;
192+
193+
expect( duplicatedLines ).toBe( 0 );
171194
done();
172195
}, 1000);
173196
});

0 commit comments

Comments
 (0)