Skip to content

Commit 0179e62

Browse files
authored
Merge pull request #63 from ssb-js/test-tweaks
Test tweaks
2 parents 7d47892 + 9bf1835 commit 0179e62

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

test/plugs.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,15 @@ if (has_ipv6)
126126
var combined = Compose([
127127
Net({
128128
scope: 'private',
129-
port: 4848,
129+
port: 4849,
130130
host: 'fe80::1065:74a4:4016:6266%wlan0'
131131
}),
132132
shs
133133
])
134134
var addr = combined.stringify('private')
135135
t.equal(
136136
addr,
137-
'net:fe80::1065:74a4:4016:6266:4848~shs:' +
137+
'net:fe80::1065:74a4:4016:6266:4849~shs:' +
138138
keys.publicKey.toString('base64')
139139
)
140140
t.end()
@@ -144,7 +144,7 @@ tape('net: do not listen on all addresses', function (t) {
144144
var combined = Compose([
145145
Net({
146146
scope: 'device',
147-
port: 4848,
147+
port: 4850,
148148
host: 'localhost',
149149
// external: scopes.host('private') // unroutable IP, but not localhost (e.g. 192.168 ...)
150150
}),
@@ -156,7 +156,7 @@ tape('net: do not listen on all addresses', function (t) {
156156
var fake_combined = Compose([
157157
Net({
158158
scope: 'local',
159-
port: 4848,
159+
port: 4851,
160160
//host: 'localhost',
161161
// external: scopes.host('local') // unroutable IP, but not localhost (e.g. 192.168 ...)
162162
}),
@@ -175,7 +175,7 @@ tape('net: do not crash if listen() fails', function(t) {
175175
var combined = Compose([
176176
Net({
177177
scope: 'private',
178-
port: 4848,
178+
port: 4852,
179179
host: '$not-a-valid-ip-addr$',
180180
}),
181181
shs
@@ -187,6 +187,21 @@ tape('net: do not crash if listen() fails', function(t) {
187187
})
188188
})
189189

190+
tape('net: stringify support external being a string', function(t) {
191+
var combined = Compose([
192+
Net({
193+
scope: 'public',
194+
port: 4853,
195+
host: 'localhost',
196+
external: 'scuttlebutt.nz'
197+
}),
198+
shs
199+
])
200+
var addr = combined.stringify('public')
201+
t.equals(addr, 'net:scuttlebutt.nz:4853~shs:' + keys.publicKey.toString('base64'))
202+
t.end()
203+
})
204+
190205
tape('combined, unix', function (t) {
191206
var combined = Compose([
192207
Unix({
@@ -432,8 +447,8 @@ tape('error should have client address on it', function (t) {
432447
})
433448

434449
tape('multiple public different hosts', function(t) {
435-
var net1 = Net({ host: '127.0.0.1', port: 4848, scope: 'public'})
436-
var net2 = Net({ host: '::1', port: 4847, scope: 'public'})
450+
var net1 = Net({ host: '127.0.0.1', port: 4854, scope: 'public'})
451+
var net2 = Net({ host: '::1', port: 4855, scope: 'public'})
437452

438453
var combined1 = Compose([net1, shs])
439454
var combined2 = Compose([net2, shs])
@@ -447,8 +462,8 @@ tape('multiple public different hosts', function(t) {
447462
})
448463

449464
tape('multiple scopes different hosts', function(t) {
450-
var net1 = Net({ host: '127.0.0.1', port: 4848, scope: ['local', 'device', 'public']})
451-
var net2 = Net({ host: '::1', port: 4847, scope: ['local', 'device', 'public']})
465+
var net1 = Net({ host: '127.0.0.1', port: 4856, scope: ['local', 'device', 'public']})
466+
var net2 = Net({ host: '::1', port: 4857, scope: ['local', 'device', 'public']})
452467

453468
var combined1 = Compose([net1, shs])
454469
var combined2 = Compose([net2, shs])

0 commit comments

Comments
 (0)