From 27ec5b545d867ecc68b7e0384da9d160fe5a44a3 Mon Sep 17 00:00:00 2001 From: mumuy Date: Tue, 27 Sep 2016 00:19:39 +0800 Subject: [PATCH] =?UTF-8?q?updated=20=E6=B5=8B=E8=AF=95=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .travis.yml | 3 ++- script/relationship.js | 11 +---------- tests/test.js | 17 ++++++++++++----- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.travis.yml b/.travis.yml index b9c9490..b5210ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ language: node_js node_js: + - "6.2.0" + - "5.6.0" - "4.4.4" - - "0.12" install: - npm install diff --git a/script/relationship.js b/script/relationship.js index c1e752b..f7bac86 100644 --- a/script/relationship.js +++ b/script/relationship.js @@ -7,7 +7,7 @@ module.exports = factory(); else root.relationship = factory(); -}(typeof window !== 'undefined' ? window : this, +}(typeof window !== 'undefined' ? window : this, function () { //简写 var _filter = [ @@ -864,12 +864,3 @@ function () { return relationship; }); - -// console.log(relationship({text:'儿子的爸爸的妈妈',sex:1})); -//爸爸的妈妈的老公的儿子的女儿 -//老婆的老公 -//老公的老婆的儿子的爸爸的老婆的儿子的爸爸 -//我的三舅的儿子的爸爸的妹妹的儿子的叔叔的哥哥 -//老婆的外孙的姥姥 -//大姨的女儿的表哥 -//爸爸的女儿的儿子 diff --git a/tests/test.js b/tests/test.js index 9a84ce7..c7b9a13 100644 --- a/tests/test.js +++ b/tests/test.js @@ -2,9 +2,16 @@ var test = require('tape'); var relationship = require('..'); -test('relationship.js show be tested', function (t) { - t.deepEqual(relationship({text: '爸爸的哥哥', sex: 1}), ['伯父']); - // TODO 添加自己的测试用例 - +test('relationship.js show to be tested', function (t) { + // 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(); -}); \ No newline at end of file +});