Skip to content
This repository has been archived by the owner on Aug 19, 2021. It is now read-only.

Travis #19

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
{
"name": "BrewSource",
"private": true,
"version": "1.0.0",
"main": "app.js",
"description": "Making fermentation control easier since 2017!",
"keywords": ["brewing", "sails", "fermentation", "beer", "brewsource", "brew", "brewery"],
"keywords": [
"brewing",
"sails",
"fermentation",
"beer",
"brewsource",
"brew",
"brewery"
],
"bugs": {
"url": "https://github.com/mortea15/BrewSource/issues"
},
"dependencies": {
"connect-redis": "^3.3.0",
"ejs": "2.3.4",
Expand All @@ -29,8 +40,9 @@
"sails-mysql": "^0.11.5"
},
"scripts": {
"start": "node app.js",
"debug": "node debug app.js",
"start": "node app.js"
"test": "mocha --timeout 10000"
},
"main": "app.js",
"repository": {
Expand All @@ -41,6 +53,8 @@
"license": "GPL-3.0",
"devDependencies": {
"request": "^2.51.0",
"sails-hook-autoreload": "^0.11.2"
"sails-hook-autoreload": "^0.11.2",
"supertest": "^3.0.0",
"mocha": "3.2.0"
}
}
23 changes: 23 additions & 0 deletions test/bootstrap.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Created by mortea15 on 02.06.2017.
*/
var sails = require('sails');

before(function(done) {

// Increase the Mocha timeout so that Sails has enough time to lift.
this.timeout(5000);

sails.lift({
// configuration for testing purposes
}, function(err) {
if (err) return done(err);
// here you can load fixtures, etc.
done(err, sails);
});
});

after(function(done) {
// here you can clear fixtures, etc.
sails.lower(done);
});
4 changes: 4 additions & 0 deletions test/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Created by mortea15 on 02.06.2017.
*/
process.env.SAILS_NEW_LINK = true;
25 changes: 25 additions & 0 deletions test/integration/controllers/UserController.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Created by mortea15 on 02.06.2017.
*/
var request = require('supertest');

describe('UserController', function() {

describe('#login()', function() {
it('should redirect to /profile', function(done) {
request(sails.hooks.http.app)
.post('/signup')
.send({ name: 'test', email: 'test@test.eu', password: 'test123', lastActive: new Date(0), lastLoggedIn: new Date(0) })
.expect(403, done);
});
});

describe('#login()', function() {
it('should redirect to /profile', function(done) {
request(sails.hooks.http.app)
.post('/login')
.send({ email: 'test@test.eu', password: 'test123' })
.expect(403, done);
});
});
});
17 changes: 17 additions & 0 deletions test/integration/models/User.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* Created by mortea15 on 02.06.2017.
*/
describe('UserModel', function() {

describe('#find()', function() {
it('should check find function', function (done) {
User.find()
.then(function(results) {
// some tests
done();
})
.catch(done);
});
});

});
4 changes: 4 additions & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--reporter spec
--recursive
--slow 2000
--timeout 5s
34 changes: 34 additions & 0 deletions travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# ╔╦╗╦═╗╔═╗╦ ╦╦╔═╗ ┬ ┬┌┬┐┬ #
# ║ ╠╦╝╠═╣╚╗╔╝║╚═╗ └┬┘││││ #
# o ╩ ╩╚═╩ ╩ ╚╝ ╩╚═╝o ┴ ┴ ┴┴─┘ #
# #
# This file configures Travis CI. #
# (i.e. how we run the tests... mainly) #
# #
# https://docs.travis-ci.com/user/customizing-the-build #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # #

language: node_js

node_js:
- "0.10"
- "0.12"
- "4"
- "6"
- "8"

sudo: required

before_install:
- npm install -g

before_script:
- npm install

script:
- npm test

notifications:
email:
- mkaa22@gmail.com