source: trip-planner-front/node_modules/multicast-dns-service-types/test.js@ e29cc2e

Last change on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1var tape = require('tape')
2var type = require('./')
3
4tape('stringifies', function (t) {
5 t.same(type.stringify('http', 'tcp'), '_http._tcp')
6 t.same(type.stringify('http', 'tcp', 'sub'), '_http._tcp._sub')
7 t.same(type.stringify('http', 'tcp', 'sub', 'sub2'), '_http._tcp._sub._sub2')
8 t.same(type.stringify('http', 'tcp', ['sub', 'sub2']), '_http._tcp._sub._sub2')
9 t.same(type.stringify({name: 'http', protocol: 'tcp', subtypes: ['sub', 'sub2']}), '_http._tcp._sub._sub2')
10 t.end()
11})
12
13tape('parses', function (t) {
14 t.same(type.parse('_http._tcp'), {name: 'http', protocol: 'tcp', subtypes: []})
15 t.same(type.parse('_http._tcp._sub'), {name: 'http', protocol: 'tcp', subtypes: ['sub']})
16 t.same(type.parse('_http._tcp._sub._sub2'), {name: 'http', protocol: 'tcp', subtypes: ['sub', 'sub2']})
17 t.end()
18})
19
20tape('shorthands', function (t) {
21 t.same(type.tcp('http'), '_http._tcp')
22 t.same(type.tcp('http', 'sub'), '_http._tcp._sub')
23 t.same(type.tcp('http', 'sub', 'sub2'), '_http._tcp._sub._sub2')
24 t.same(type.tcp('http', ['sub', 'sub2']), '_http._tcp._sub._sub2')
25 t.end()
26})
Note: See TracBrowser for help on using the repository browser.