forked from GitbookIO/nuts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
234 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,48 @@ | ||
{ | ||
"name": "nuts-serve", | ||
"version": "2.6.2", | ||
"description": "Server to make GitHub releases (private) available to download with Squirrel support", | ||
"main": "./lib/index.js", | ||
"homepage": "https://github.com/GitbookIO/nuts", | ||
"license": "Apache-2.0", | ||
"main": "./lib/index.js", | ||
"dependencies": { | ||
"express": "^4.13.3", | ||
"lodash": "3.7.0", | ||
"q": "1.2.0", | ||
"body-parser": "1.12.3", | ||
"octonode": "0.7.1", | ||
"semver": "5.0.1", | ||
"request": "2.60.0", | ||
"basic-auth": "1.0.3", | ||
"express-useragent": "0.1.9", | ||
"stores": "0.0.2", | ||
"analytics-node": "1.2.2", | ||
"uuid": "2.0.1", | ||
"github-webhook-handler": "0.5.0", | ||
"strip-bom": "2.0.0", | ||
"destroy": "1.0.3" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.18.2", | ||
"should": "7.0.4" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/GitbookIO/nuts/issues" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Samy Pesse", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"repository": { | ||
"type" : "git", | ||
"url" : "https://github.com/GitbookIO/nuts.git" | ||
}, | ||
"scripts": { | ||
"start": "node bin/web.js", | ||
"test": "mocha --reporter list" | ||
"name": "nuts-serve", | ||
"version": "2.6.2", | ||
"description": "Server to make GitHub releases (private) available to download with Squirrel support", | ||
"main": "./lib/index.js", | ||
"homepage": "https://github.com/GitbookIO/nuts", | ||
"license": "Apache-2.0", | ||
"dependencies": { | ||
"analytics-node": "1.2.2", | ||
"basic-auth": "1.0.3", | ||
"body-parser": "1.12.3", | ||
"destroy": "1.0.3", | ||
"express": "^4.13.3", | ||
"express-useragent": "0.1.9", | ||
"github-webhook-handler": "0.5.0", | ||
"lodash": "3.7.0", | ||
"octonode": "0.7.1", | ||
"q": "1.2.0", | ||
"request": "2.60.0", | ||
"semver": "5.0.1", | ||
"stores": "0.0.2", | ||
"strip-bom": "2.0.0", | ||
"uuid": "2.0.1" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1.18.2", | ||
"mockery": "^1.4.0", | ||
"rewire": "^2.5.1", | ||
"should": "7.0.4" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/GitbookIO/nuts/issues" | ||
}, | ||
"authors": [ | ||
{ | ||
"name": "Samy Pesse", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/GitbookIO/nuts.git" | ||
}, | ||
"scripts": { | ||
"start": "node bin/web.js", | ||
"test": "mocha --reporter list" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
var | ||
_ = require('lodash'), | ||
should = require('should'), | ||
rewire = require('rewire'); | ||
|
||
describe('Versions', function() { | ||
|
||
var Versions = rewire('../lib/versions'); | ||
var versionChecker = Versions.__get__('newVersionFilter'); | ||
|
||
var testVersions = [ | ||
{ tag: '0.0.8-alpha.1', | ||
channel: 'alpha', | ||
notes: 'More placeholder text.', | ||
published_at: 'Mon Dec 14 2015 12:13:58 GMT-0800 (PST)', | ||
platforms: [ { | ||
type: 'osx_64' | ||
}, { | ||
type: 'windows_32' | ||
} ], | ||
download_count: 3 }, | ||
{ tag: '0.0.7', | ||
channel: 'stable', | ||
notes: 'Kinda drifted away from the story thing and I\'m just writing random stuff now.', | ||
published_at: 'Mon Dec 14 2015 11:41:30 GMT-0800 (PST)', | ||
platforms: [ { | ||
type: 'osx_64' | ||
}, { | ||
type: 'windows_32' | ||
} ], | ||
download_count: 0 }, | ||
{ tag: '0.0.7-beta.1', | ||
channel: 'beta', | ||
notes: 'A beautiful brand new release', | ||
published_at: 'Fri Dec 11 2015 17:01:43 GMT-0800 (PST)', | ||
platforms: [ { | ||
type: 'osx_64' | ||
}, { | ||
type: 'windows_32' | ||
} ], | ||
download_count: 0 }, | ||
{ tag: '0.0.7-alpha.2', | ||
channel: 'alpha', | ||
notes: 'More excitement!!!', | ||
published_at: 'Fri Dec 11 2015 17:21:08 GMT-0800 (PST)', | ||
platforms: [ { | ||
type: 'osx_64' | ||
}, { | ||
type: 'windows_32' | ||
} ], | ||
download_count: 0 }, | ||
{ tag: '0.0.7-alpha.1', | ||
channel: 'alpha', | ||
notes: 'A beautiful brand new release', | ||
published_at: 'Fri Dec 11 2015 17:01:43 GMT-0800 (PST)', | ||
platforms: [ { | ||
type: 'osx_64' | ||
}, { | ||
type: 'windows_32' | ||
} ], | ||
download_count: 0 }, | ||
{ tag: '0.0.6', | ||
channel: 'stable', | ||
notes: 'A wonderful new release!', | ||
published_at: 'Fri Dec 11 2015 15:55:45 GMT-0800 (PST)', | ||
platforms: [ { | ||
type: 'osx_64' | ||
}, { | ||
type: 'windows_32' | ||
} ], | ||
download_count: 2 } | ||
]; | ||
|
||
function testFilterVersions(opts) { | ||
return _.chain(testVersions) | ||
.filter(versionChecker(opts)) | ||
.pluck('tag') | ||
.value(); | ||
} | ||
|
||
it(':: current tag: latest stable | channel param: none --> nothing', function() { | ||
var opts = { | ||
tag: '0.0.7', | ||
platform: 'osx', | ||
channel: undefined | ||
} | ||
console.log(testFilterVersions(opts)) | ||
_.isEqual(testFilterVersions(opts), []).should.be.true(); | ||
}); | ||
|
||
it(':: current tag: older stable | channel param: none --> new stable', function() { | ||
var opts = { | ||
tag: '0.0.6', | ||
platform: 'osx', | ||
channel: undefined | ||
} | ||
console.log(testFilterVersions(opts)) | ||
_.isEqual(testFilterVersions(opts), ['0.0.7']).should.be.true(); | ||
}); | ||
|
||
it(':: current tag: older beta | channel param: none --> new stable', function() { | ||
var opts = { | ||
tag: '0.0.7-beta.1', | ||
platform: 'osx', | ||
channel: undefined | ||
} | ||
console.log(testFilterVersions(opts)) | ||
_.isEqual(testFilterVersions(opts), ['0.0.7']).should.be.true(); | ||
}); | ||
|
||
it(':: current tag: older alpha | channel param: alpha --> new alpha', function() { | ||
var opts = { | ||
tag: '0.0.7-alpha.2', | ||
platform: 'osx', | ||
channel: 'alpha' | ||
} | ||
console.log(testFilterVersions(opts)) | ||
_.isEqual(testFilterVersions(opts), ['0.0.8-alpha.1']).should.be.true(); | ||
}); | ||
|
||
it(':: current tag: older beta | channel param: beta --> nothing', function() { | ||
var opts = { | ||
tag: '0.0.7-beta.1', | ||
platform: 'osx', | ||
channel: 'beta' | ||
} | ||
console.log(testFilterVersions(opts)) | ||
_.isEqual(testFilterVersions(opts), []).should.be.true(); | ||
}); | ||
|
||
}); |