| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123 |
1×
| import test from 'ava';
import generate from '../src/lib/generate';
function testOutput(t, expected, masterPassword, url = 'example.com', options = {}) {
t.plan(1);
generate(masterPassword, url, options, (password) => {
t.is(password, expected);
t.end();
});
}
const testData = [
[
'w9UbG0NEk7', // expected output
'test', // master password
// url (default = 'example.com')
// optional options hash (default = {})
],
[
'sJfoZg3nU8',
'test',
'example.com',
{
method: 'sha512',
},
],
[
'aC81',
'test',
'example.com',
{
length: 4,
method: 'sha512',
},
],
[
'vBKDNdjhhL6dBfgDSRxZxAAA',
'test',
'example.com',
{
length: 24,
method: 'md5',
},
],
[
'sJfoZg3nU8y32EyHFRlSY08u',
'test',
'example.com',
{
length: 24,
method: 'sha512',
},
],
[
'zPQSNhTzs9fS',
'test',
'https://www.google.com/',
{
length: 12,
secret: 'test',
},
],
[
'q8ZWYccWDt',
'test',
'https://www.google.com/',
{
removeSubdomains: false,
method: 'sha512',
},
],
[
'aRFG84Gim9',
'test',
'example.co.uk',
],
[
'hSF8nTst4A',
'test',
'example.gov.ac',
],
[
'ft8iv4t5sX',
'Γαζέες καὶ μυρτιὲς δὲν θὰ βρῶ πιὰ στὸ χρυσαφὶ ξέφωτο',
],
[
'o1AWdbILuJ',
'Benjamín pidió una bebida de kiwi y fresa',
],
[
'uqWgZf34mr',
'Ça me fait peur de fêter noël là, sur cette île bizarroïde où',
],
[
'iUL7ndPlsD',
'Árvíztűrő tükörfúrógép',
],
[
'fDOVXY6AhC',
'わかよたれそつねならむ',
],
[
'i4LtmfRGl8',
'ウヰノオクヤマ ケフコエテ',
],
[
'wD8T8KozGO',
'מצא לו חברה איך הקליטה',
],
[
'jtUcAzTL4l',
'В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!',
],
[
'rnXePhv0JG',
'จงฝ่าฟันพัฒนาวิชาการ',
],
];
testData.forEach((args) => {
test.cb('password generation', testOutput, ...args);
});
|