Update tests for gitlab
This commit is contained in:
parent
b3479983aa
commit
13400ea4d3
5 changed files with 33 additions and 24 deletions
|
@ -3,21 +3,14 @@ services:
|
|||
- mongo
|
||||
|
||||
stages:
|
||||
- seed
|
||||
- test
|
||||
|
||||
seed:
|
||||
stage: seed
|
||||
image: mongo
|
||||
script:
|
||||
- mongo --host mongo hostr test/fixtures/mongo-user.js test/fixtures/mongo-file.js
|
||||
tags:
|
||||
- docker
|
||||
|
||||
test:
|
||||
stage: test
|
||||
before_script:
|
||||
- npm install
|
||||
- jspm install
|
||||
- node test/fixtures/mongo-user.js test/fixtures/mongo-file.js
|
||||
script:
|
||||
- npm test
|
||||
tags:
|
||||
|
@ -27,4 +20,5 @@ cache:
|
|||
key: "$CI_BUILD_REF_NAME"
|
||||
untracked: true
|
||||
paths:
|
||||
- node_modules
|
||||
- node_modules
|
||||
- web/public/jspm_packages
|
||||
|
|
2
app.js
2
app.js
|
@ -43,7 +43,7 @@ app.use(function* errorMiddleware(next) {
|
|||
try {
|
||||
yield next;
|
||||
} catch (err) {
|
||||
if (!err.statusCode) {
|
||||
if (!err.statusCode && this.raven) {
|
||||
this.raven.captureError(err);
|
||||
}
|
||||
throw err;
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
"init": "node -r babel/register -e \"require('./lib/storage')();\"",
|
||||
"jspm": "jspm install",
|
||||
"start": "npm run build && node -r babel/register app.js",
|
||||
"test": "mongo hostr test/fixtures/mongo-*.js && mocha -r babel/register test/**/*.spec.js",
|
||||
"test": "npm run test-seed && mocha -r babel/register test/**/*.spec.js",
|
||||
"test-seed": "node test/fixtures/mongo-user.js && node test/fixtures/mongo-file.js",
|
||||
"watch": "parallelshell \"npm run watch-js\" \"npm run watch-sass\" \"npm run watch-server\"",
|
||||
"watch-js": "babel -Dw -m system -d web/public/build web/public/src",
|
||||
"watch-server": "nodemon -r babel/register app.js",
|
||||
|
|
15
test/fixtures/mongo-file.js
vendored
15
test/fixtures/mongo-file.js
vendored
|
@ -1,5 +1,12 @@
|
|||
db.files.createIndex({
|
||||
"owner": 1,
|
||||
"status": 1,
|
||||
"time_added": -1
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
const url = 'mongodb://localhost:27017/hostr';
|
||||
|
||||
MongoClient.connect(url, function connect(err, db) {
|
||||
const collection = db.collection('files');
|
||||
collection.createIndex({
|
||||
'owner': 1,
|
||||
'status': 1,
|
||||
'time_added': -1,
|
||||
});
|
||||
db.close();
|
||||
});
|
||||
|
|
23
test/fixtures/mongo-user.js
vendored
23
test/fixtures/mongo-user.js
vendored
|
@ -1,9 +1,16 @@
|
|||
db.users.remove({
|
||||
"email": "test@hostr.co"
|
||||
});
|
||||
db.users.save({
|
||||
"email": "test@hostr.co",
|
||||
"salted_password": "$pbkdf2-256-1$2$kBhIDRqFwnF/1ms6ZHfME2o2$a48e8c350d26397fcc88bf0a7a2817b1cdcd1ffffe0521a5",
|
||||
"joined": Math.ceil(Date.now()/1000),
|
||||
"signup_ip": "127.0.0.1"
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
const url = 'mongodb://localhost:27017/hostr';
|
||||
|
||||
MongoClient.connect(url, function connect(err, db) {
|
||||
const collection = db.collection('users');
|
||||
collection.remove({
|
||||
'email': 'test@hostr.co',
|
||||
});
|
||||
collection.save({
|
||||
'email': 'test@hostr.co',
|
||||
'salted_password': '$pbkdf2-256-1$2$kBhIDRqFwnF/1ms6ZHfME2o2$a48e8c350d26397fcc88bf0a7a2817b1cdcd1ffffe0521a5',
|
||||
'joined': Math.ceil(Date.now() / 1000),
|
||||
'signup_ip': '127.0.0.1',
|
||||
});
|
||||
db.close();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue