Skip to content

Commit

Permalink
validate duplicated
Browse files Browse the repository at this point in the history
  • Loading branch information
yanni4night committed Nov 16, 2016
1 parent 38dd48a commit c43adbe
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 19 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
[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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
49 changes: 32 additions & 17 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
});
});

0 comments on commit c43adbe

Please sign in to comment.