From c43adbe294307642b0d996b2e73ddbe9eb9b007a Mon Sep 17 00:00:00 2001 From: yinyong02 Date: Wed, 16 Nov 2016 09:52:08 +0800 Subject: [PATCH] validate duplicated --- CHANGELOG.md | 10 +++++++++- package.json | 2 +- test/test.js | 49 ++++++++++++++++++++++++++++++++----------------- 3 files changed, 42 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8190ea9..d9c46a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] + +## [1.1.0] - 2016-11-16 +### Changed +- validate duplicated +- validate duplicated version keys + +## 1.0.0 - 2016-11-14 ### Added - Initialize and publish this project with test cases and RN 0.35.0 -[Unreleased]: https://github.com/super-fe/superfe-compatible-rn-versions/compare/1.0.0...HEAD \ No newline at end of file +[1.1.0]: https://github.com/super-fe/superfe-compatible-rn-versions/compare/1.0.0...1.1.0 +[Unreleased]: https://github.com/super-fe/superfe-compatible-rn-versions/compare/1.1.0...HEAD \ No newline at end of file diff --git a/package.json b/package.json index 9e44aaa..3c8b57c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "superfe-compatible-rn-versions", - "version": "1.0.0", + "version": "1.1.0", "description": "React-native versions that super-fe should be compatible to", "main": "index.js", "scripts": { diff --git a/test/test.js b/test/test.js index 609e692..be4b0e4 100644 --- a/test/test.js +++ b/test/test.js @@ -4,23 +4,38 @@ var semver = require('semver'); var assert = require('assert'); describe('versions', function () { - it('should be an array', function () { - assert.ok(Array.isArray(versions)); - }); - it('each should be a legal version', function (done) { - this.timeout(5e3); + it('should be an array', function () { + assert.ok(Array.isArray(versions)); + }); + + it('each should be a valid version', function () { + versions.forEach(function (ver) { + assert.ok(semver.valid(ver)); + }); + }); + + it('never values are duplicated', function () { + var map = {}; + versions.forEach(function (ver) { + assert.ok(!(ver in map)); + map[ver] = 1; + }); + }); + + it('each should be a legal npm version', function (done) { + this.timeout(5e3); - pkgVersions('react-native', function (err, vers) { - if (err) { - return done(err); - } - versions.forEach(function (version) { - assert.ok(semver.gte(version, '0.35.0'), version + ' >= 0.35.0 '); - assert.ok(vers.some(function (ver) { - return ver === version; - }), version + ' should be on npm'); - }); - done(); + pkgVersions('react-native', function (err, vers) { + if (err) { + return done(err); + } + versions.forEach(function (version) { + assert.ok(semver.gte(version, '0.35.0'), version + ' >= 0.35.0 '); + assert.ok(vers.some(function (ver) { + return ver === version; + }), version + ' should be on npm'); + }); + done(); + }); }); - }); }); \ No newline at end of file