password presenter test

This commit is contained in:
antelle 2020-03-21 12:24:21 +01:00
parent c6c307c50c
commit 29329f924e
2 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import 'util/kdbxweb/protected-value-ex';
import { shuffle } from 'util/fn';
class RandomNameGenerator {

View File

@ -0,0 +1,14 @@
import kdbxweb from 'kdbxweb';
import { expect } from 'chai';
import { PasswordPresenter } from 'util/formatting/password-presenter';
describe('UrlFormat', () => {
it('should replace passwords with dots', () => {
expect(PasswordPresenter.present(10)).to.match(/^•{10}$/);
});
it('should preserve line breaks in passwords', () => {
const pw = kdbxweb.ProtectedValue.fromString('12\nabc\n\nd');
expect(PasswordPresenter.presentValueWithLineBreaks(pw)).to.eql('••\n•••\n\n•');
});
});