diff --git a/.travis.yml b/.travis.yml index 3071aca4..4b4555fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,7 @@ before_script: - bower install - cd test - bower install + - npm install - cd .. after_script: - npm run coveralls diff --git a/src/mock/random/date.js b/src/mock/random/date.js index 0c3799ad..fd87ee42 100644 --- a/src/mock/random/date.js +++ b/src/mock/random/date.js @@ -113,6 +113,7 @@ module.exports = { format = format || 'yyyy-MM-dd HH:mm:ss' var date = new Date() + var extraDay = 0 /* jshint -W086 */ // 参考自 http://momentjs.cn/docs/#/manipulating/start-of/ @@ -121,6 +122,7 @@ module.exports = { date.setMonth(0) case 'month': date.setDate(1) + case 'weekiso': case 'week': case 'day': date.setHours(0) @@ -132,8 +134,10 @@ module.exports = { date.setMilliseconds(0) } switch (unit) { + case 'weekiso': + extraDay++ case 'week': - date.setDate(date.getDate() - date.getDay()) + date.setDate(date.getDate() - date.getDay() + extraDay) } return this._formatDate(date, format) diff --git a/test/package.json b/test/package.json index b26a3b84..3031f990 100644 --- a/test/package.json +++ b/test/package.json @@ -1,6 +1,6 @@ { "name": "test", "dependencies": { - "chai": "^1.10.0" + "mocha": "^4.0.1" } } diff --git a/test/test.mock.html b/test/test.mock.html index ec263a74..05155aac 100644 --- a/test/test.mock.html +++ b/test/test.mock.html @@ -4,7 +4,7 @@ Test: Mock - +