updated 测试代码添加
This commit is contained in:
parent
e8e3785c33
commit
27ec5b545d
@ -1,8 +1,9 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
|
|
||||||
node_js:
|
node_js:
|
||||||
|
- "6.2.0"
|
||||||
|
- "5.6.0"
|
||||||
- "4.4.4"
|
- "4.4.4"
|
||||||
- "0.12"
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- npm install
|
- npm install
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
module.exports = factory();
|
module.exports = factory();
|
||||||
else
|
else
|
||||||
root.relationship = factory();
|
root.relationship = factory();
|
||||||
}(typeof window !== 'undefined' ? window : this,
|
}(typeof window !== 'undefined' ? window : this,
|
||||||
function () {
|
function () {
|
||||||
//简写
|
//简写
|
||||||
var _filter = [
|
var _filter = [
|
||||||
@ -864,12 +864,3 @@ function () {
|
|||||||
|
|
||||||
return relationship;
|
return relationship;
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log(relationship({text:'儿子的爸爸的妈妈',sex:1}));
|
|
||||||
//爸爸的妈妈的老公的儿子的女儿
|
|
||||||
//老婆的老公
|
|
||||||
//老公的老婆的儿子的爸爸的老婆的儿子的爸爸
|
|
||||||
//我的三舅的儿子的爸爸的妹妹的儿子的叔叔的哥哥
|
|
||||||
//老婆的外孙的姥姥
|
|
||||||
//大姨的女儿的表哥
|
|
||||||
//爸爸的女儿的儿子
|
|
||||||
|
@ -2,9 +2,16 @@
|
|||||||
var test = require('tape');
|
var test = require('tape');
|
||||||
var relationship = require('..');
|
var relationship = require('..');
|
||||||
|
|
||||||
test('relationship.js show be tested', function (t) {
|
test('relationship.js show to be tested', function (t) {
|
||||||
t.deepEqual(relationship({text: '爸爸的哥哥', sex: 1}), ['伯父']);
|
// TODO
|
||||||
// TODO 添加自己的测试用例
|
t.deepEqual(relationship({text:'儿子的爸爸的妈妈',sex:1}),['妈妈']);
|
||||||
|
t.deepEqual(relationship({text:'老婆的老公',sex:1}),['自己']);
|
||||||
|
t.deepEqual(relationship({text:'老婆的外孙的姥爷',sex:1}),['自己']);
|
||||||
|
t.deepEqual(relationship({text:'表姐的哥哥',sex:1}),['表哥(姑家)','表哥(舅家)','表哥(姨家)']);
|
||||||
|
t.deepEqual(relationship({text:'表姐的妹妹',sex:1}),['表姐(姑家)','表妹(姑家)','表姐(舅家)','表妹(舅家)','表姐(姨家)','表妹(姨家)']);
|
||||||
|
t.deepEqual(relationship({text:'老公的老婆的儿子的爸爸',sex:0}),['老公']);
|
||||||
|
t.deepEqual(relationship({text:'爸爸的舅舅',sex:0,reverse:true}),['外甥孙女']);
|
||||||
|
t.deepEqual(relationship({text:'舅爷爷',type:'chain'}),['爸爸的妈妈的兄弟']);
|
||||||
|
|
||||||
t.end();
|
t.end();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user