vue hello world项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

26 lines
1.1 KiB

var tape = require('tape')
var type = require('./')
tape('stringifies', function (t) {
t.same(type.stringify('http', 'tcp'), '_http._tcp')
t.same(type.stringify('http', 'tcp', 'sub'), '_http._tcp._sub')
t.same(type.stringify('http', 'tcp', 'sub', 'sub2'), '_http._tcp._sub._sub2')
t.same(type.stringify('http', 'tcp', ['sub', 'sub2']), '_http._tcp._sub._sub2')
t.same(type.stringify({name: 'http', protocol: 'tcp', subtypes: ['sub', 'sub2']}), '_http._tcp._sub._sub2')
t.end()
})
tape('parses', function (t) {
t.same(type.parse('_http._tcp'), {name: 'http', protocol: 'tcp', subtypes: []})
t.same(type.parse('_http._tcp._sub'), {name: 'http', protocol: 'tcp', subtypes: ['sub']})
t.same(type.parse('_http._tcp._sub._sub2'), {name: 'http', protocol: 'tcp', subtypes: ['sub', 'sub2']})
t.end()
})
tape('shorthands', function (t) {
t.same(type.tcp('http'), '_http._tcp')
t.same(type.tcp('http', 'sub'), '_http._tcp._sub')
t.same(type.tcp('http', 'sub', 'sub2'), '_http._tcp._sub._sub2')
t.same(type.tcp('http', ['sub', 'sub2']), '_http._tcp._sub._sub2')
t.end()
})