Skip to content

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdidon committed Mar 24, 2021
1 parent d35c9ff commit c195146
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions test/bonjour.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ test('bonjour.find', function (bonjour, t) {
t.equal(s.name, 'Foo Bar')
t.equal(s.fqdn, 'Foo Bar._test._tcp.local')
t.deepEqual(s.txt, {})
t.deepEqual(s.rawTxt, new Buffer('00', 'hex'))
t.deepEqual(s.rawTxt, Buffer.from('00', 'hex'))
} else {
t.equal(s.name, 'Baz')
t.equal(s.fqdn, 'Baz._test._tcp.local')
t.deepEqual(s.txt, { foo: 'bar' })
t.deepEqual(s.rawTxt, new Buffer('07666f6f3d626172', 'hex'))
t.deepEqual(s.rawTxt, Buffer.from('07666f6f3d626172', 'hex'))
}
t.equal(s.host, os.hostname())
t.equal(s.port, 3000)
Expand Down Expand Up @@ -122,14 +122,14 @@ test('bonjour.find - binary txt', function (bonjour, t) {

browser.on('up', function (s) {
t.equal(s.name, 'Foo')
t.deepEqual(s.txt, { bar: new Buffer('buz') })
t.deepEqual(s.rawTxt, new Buffer('076261723d62757a', 'hex'))
t.deepEqual(s.txt, { bar: Buffer.from('buz') })
t.deepEqual(s.rawTxt, Buffer.from('076261723d62757a', 'hex'))
bonjour.destroy()
t.end()
})
})

bonjour.publish({ name: 'Foo', type: 'test', port: 3000, txt: { bar: new Buffer('buz') } }).on('up', next())
bonjour.publish({ name: 'Foo', type: 'test', port: 3000, txt: { bar: Buffer.from('buz') } }).on('up', next())
})

test('bonjour.find - down event', function (bonjour, t) {
Expand Down
4 changes: 2 additions & 2 deletions test/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ test('_records() - minimal', function (t) {
t.deepEqual(s._records(), [
{ data: s.fqdn, name: '_http._tcp.local', ttl: 28800, type: 'PTR' },
{ data: { port: 3000, target: os.hostname() }, name: s.fqdn, ttl: 120, type: 'SRV' },
{ data: new Buffer('00', 'hex'), name: s.fqdn, ttl: 4500, type: 'TXT' }
{ data: Buffer.from('00', 'hex'), name: s.fqdn, ttl: 4500, type: 'TXT' }
].concat(getAddressesRecords(s.host)))
t.end()
})
Expand All @@ -86,7 +86,7 @@ test('_records() - everything', function (t) {
t.deepEqual(s._records(), [
{ data: s.fqdn, name: '_http._tcp.local', ttl: 28800, type: 'PTR' },
{ data: { port: 3000, target: 'example.com' }, name: s.fqdn, ttl: 120, type: 'SRV' },
{ data: new Buffer('07666f6f3d626172', 'hex'), name: s.fqdn, ttl: 4500, type: 'TXT' }
{ data: Buffer.from('07666f6f3d626172', 'hex'), name: s.fqdn, ttl: 4500, type: 'TXT' }
].concat(getAddressesRecords(s.host)))
t.end()
})

0 comments on commit c195146

Please sign in to comment.