-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.js
100 lines (61 loc) · 2.19 KB
/
test.js
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
var expect = require('chai').expect,
FNV = require('./index');
var allGoodMen = 'Now is the time for all good men to come to the aid of the country.';
describe('FNV', function() {
describe('.hex', function() {
it('generates FNV hashes for strings', function() {
expect(FNV.hex(''))
.to.equal('6c62272e07bb014262b821756295c58d');
expect(FNV.hex('a'))
.to.equal('d228cb696f1a8caf78912b704e4a8964');
expect(FNV.hex('aa'))
.to.equal('08809544baab1be95aa0733055b69927');
expect(FNV.hex('hello world'))
.to.equal('6c155799fdc8eec4b91523808e7726b7');
expect(FNV.hex(allGoodMen))
.to.equal('51b38e5a1cb756b30e89c2424df530f3');
});
});
describe('.base64', function() {
it('generates FNV hashes for strings', function() {
expect(FNV.base64(''))
.to.equal('bGInLge7AUJiuCF1YpXFjQ==');
expect(FNV.base64('a'))
.to.equal('0ijLaW8ajK94kStwTkqJZA==');
expect(FNV.base64('aa'))
.to.equal('CICVRLqrG+laoHMwVbaZJw==');
expect(FNV.base64('hello world'))
.to.equal('bBVXmf3I7sS5FSOAjncmtw==');
expect(FNV.base64(allGoodMen))
.to.equal('UbOOWhy3VrMOicJCTfUw8w==');
});
});
describe('.base64Url', function() {
it('generates FNV hashes for strings', function() {
expect(FNV.base64Url(''))
.to.equal('bGInLge7AUJiuCF1YpXFjQ');
expect(FNV.base64Url('a'))
.to.equal('0ijLaW8ajK94kStwTkqJZA');
expect(FNV.base64Url('aa'))
.to.equal('CICVRLqrG-laoHMwVbaZJw');
expect(FNV.base64Url('hello world'))
.to.equal('bBVXmf3I7sS5FSOAjncmtw');
expect(FNV.base64Url(allGoodMen))
.to.equal('UbOOWhy3VrMOicJCTfUw8w');
});
});
describe('.base36', function() {
it('generates FNV hashes for strings', function() {
expect(FNV.base36(''))
.to.equal('6ezv16m7wweombnkd3ldlii6l');
expect(FNV.base36('a'))
.to.equal('cfwr9hnz04ggt3okf3kia57xg');
expect(FNV.base36('aa'))
.to.equal('i4cjt3djtneq4zg3dmh5dyjr');
expect(FNV.base36('hello world'))
.to.equal('6ecu9ro7dc0j08gi9bct68uk7');
expect(FNV.base36(allGoodMen))
.to.equal('4u4ncckaq1vh7avhw1j3bfbw3');
});
});
});