mirror of
https://github.com/quine-global/hyper.git
synced 2026-01-13 04:28:41 -09:00
Add the very first test 🎉 (#549)
* Add syntactic support for tags - #412 * Add the very first test 🎉 * Simplify multiple assertions into one
This commit is contained in:
parent
2d4b518519
commit
f175268912
5 changed files with 51 additions and 4 deletions
|
|
@ -31,6 +31,7 @@ addons:
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v1.2.1/git-lfs-$([ "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-1.2.1.tar.gz | tar -xz -C /tmp/git-lfs --strip-components 1 && /tmp/git-lfs/git-lfs pull
|
- mkdir -p /tmp/git-lfs && curl -L https://github.com/github/git-lfs/releases/download/v1.2.1/git-lfs-$([ "$TRAVIS_OS_NAME" == "linux" ] && echo "linux" || echo "darwin")-amd64-1.2.1.tar.gz | tar -xz -C /tmp/git-lfs --strip-components 1 && /tmp/git-lfs/git-lfs pull
|
||||||
|
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DISPLAY=:99.0; sh -e /etc/init.d/xvfb start; sleep 3; fi
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- nvm install 6
|
- nvm install 6
|
||||||
|
|
|
||||||
|
|
@ -190,8 +190,19 @@ function alert (message) {
|
||||||
function toDependencies (plugins) {
|
function toDependencies (plugins) {
|
||||||
const obj = {};
|
const obj = {};
|
||||||
plugins.plugins.forEach((plugin) => {
|
plugins.plugins.forEach((plugin) => {
|
||||||
const pieces = plugin.split('#');
|
const regex = /.(@|#)/;
|
||||||
obj[pieces[0]] = null == pieces[1] ? 'latest' : pieces[1];
|
const match = regex.exec(plugin);
|
||||||
|
|
||||||
|
if (match) {
|
||||||
|
const index = match.index + 1;
|
||||||
|
const pieces = [];
|
||||||
|
|
||||||
|
pieces[0] = plugin.substring(0, index);
|
||||||
|
pieces[1] = plugin.substring(index + 1, plugin.length);
|
||||||
|
obj[pieces[0]] = pieces[1];
|
||||||
|
} else {
|
||||||
|
obj[plugin] = 'latest';
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
@ -321,3 +332,5 @@ exports.getDecoratedConfig = function () {
|
||||||
exports.getDecoratedBrowserOptions = function (defaults) {
|
exports.getDecoratedBrowserOptions = function (defaults) {
|
||||||
return decorateObject(defaults, 'decorateBrowserOptions');
|
return decorateObject(defaults, 'decorateBrowserOptions');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports._toDependencies = toDependencies;
|
||||||
|
|
|
||||||
10
package.json
10
package.json
|
|
@ -13,8 +13,10 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"aphrodite-simple": "0.4.1",
|
"aphrodite-simple": "0.4.1",
|
||||||
"color": "0.11.3",
|
"color": "0.11.3",
|
||||||
|
"electron-mocha": "^3.0.0",
|
||||||
"hterm-umdjs": "1.1.3",
|
"hterm-umdjs": "1.1.3",
|
||||||
"json-loader": "0.5.4",
|
"json-loader": "0.5.4",
|
||||||
|
"mocha": "^3.0.0",
|
||||||
"mousetrap": "1.6.0",
|
"mousetrap": "1.6.0",
|
||||||
"ms": "0.7.1",
|
"ms": "0.7.1",
|
||||||
"object-values": "1.0.0",
|
"object-values": "1.0.0",
|
||||||
|
|
@ -27,7 +29,8 @@
|
||||||
"redux": "3.5.2",
|
"redux": "3.5.2",
|
||||||
"redux-thunk": "2.1.0",
|
"redux-thunk": "2.1.0",
|
||||||
"reselect": "2.5.3",
|
"reselect": "2.5.3",
|
||||||
"seamless-immutable": "6.1.1"
|
"seamless-immutable": "6.1.1",
|
||||||
|
"should": "^10.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-cli": "^6.11.4",
|
"babel-cli": "^6.11.4",
|
||||||
|
|
@ -73,6 +76,9 @@
|
||||||
"ecmaFeatures": {
|
"ecmaFeatures": {
|
||||||
"jsx": true
|
"jsx": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"env": {
|
||||||
|
"mocha": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
|
|
@ -96,7 +102,7 @@
|
||||||
"dev": "webpack --watch",
|
"dev": "webpack --watch",
|
||||||
"lint": "eslint .",
|
"lint": "eslint .",
|
||||||
"build": "NODE_ENV=production webpack",
|
"build": "NODE_ENV=production webpack",
|
||||||
"test": "npm run lint",
|
"test": "npm run lint && electron-mocha test/*",
|
||||||
"start": "electron app",
|
"start": "electron app",
|
||||||
"prepublish": "npm test",
|
"prepublish": "npm test",
|
||||||
"prepush": "npm test",
|
"prepush": "npm test",
|
||||||
|
|
|
||||||
22
test/app/plugins.js
Normal file
22
test/app/plugins.js
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
require('../setup');
|
||||||
|
|
||||||
|
const {_toDependencies} = require('../../app/plugins');
|
||||||
|
|
||||||
|
describe('plugins', function () {
|
||||||
|
describe('#toDependencies()', function () {
|
||||||
|
it('should convert dependencies form hyperterm\'s format to npm\'s', function () {
|
||||||
|
const plugins = ['project1', 'project2#1.0.0', 'project3@beta',
|
||||||
|
'@org1/project4#1.0.0', '@org2/project5@alpha',
|
||||||
|
'@org3/project6'];
|
||||||
|
|
||||||
|
_toDependencies({plugins: plugins}).should.be.eql({
|
||||||
|
'project1': 'latest',
|
||||||
|
'project2': '1.0.0',
|
||||||
|
'project3': 'beta',
|
||||||
|
'@org1/project4': '1.0.0',
|
||||||
|
'@org2/project5': 'alpha',
|
||||||
|
'@org3/project6': 'latest'
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
5
test/setup.js
Normal file
5
test/setup.js
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
require('should');
|
||||||
|
|
||||||
|
const config = require('../app/config');
|
||||||
|
|
||||||
|
config.init();
|
||||||
Loading…
Reference in a new issue