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

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoTheThird committed May 2, 2018
1 parent 2e40d81 commit a26a164
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# ubuntu-touch.io
[![Build Status](https://travis-ci.org/ubports/ubuntu-touch.io.svg?branch=master)](https://travis-ci.org/ubports/ubuntu-touch.io)
[![Coverage Status](https://coveralls.io/repos/github/ubports/ubuntu-touch.io/badge.svg?branch=master)](https://coveralls.io/github/ubports/ubuntu-touch.io?branch=master)
# devices.ubuntu-touch.io

The new Ubuntu Touch website
[![Build Status](https://travis-ci.org/ubports/devices.ubuntu-touch.io.svg?branch=master)](https://travis-ci.org/ubports/devices.ubuntu-touch.io)
[![Coverage Status](https://coveralls.io/repos/github/ubports/devices.ubuntu-touch.io/badge.svg?branch=master)](https://coveralls.io/github/ubports/devices.ubuntu-touch.io?branch=master)

The new Ubuntu Touch website

## start debug server

Expand Down
32 changes: 17 additions & 15 deletions test/test_dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var request = require('request');
var expect = require('chai').expect;

var url = 'http://localhost:2700/';
var pages = ["", "apps", "features", "install", "convergence",
"design", "privacy", "devices", "telegram"]
var devices = ["FP2", "bacon", "hammerhead", "cooler", "frieza", "krillin", "vegetahd", "arale", "turbo", "mako"]
var redirects = ["apps", "features", "install", "convergence", "design", "privacy", "devices", "telegram"]
var server;

console.log(4)
Expand All @@ -18,31 +18,33 @@ before((ok) => {
})

describe("testing "+process.env.NODE_ENV, function () {
pages.forEach(function (page) {
describe("testing: "+url+page, function () {
devices.forEach(function (device) {
describe("testing: " + url + "device/"+ device, function () {
it('should return 200', function (done) {
request.get(url+page, function (err, res, body){
request.get(url + "device/"+ device, function (err, res, body){
expect(res.statusCode).to.equal(200);
done();
});
});
it('should return 404', function (done) {
request.post(url+page, function (err, res, body){
request.post(url + "device/"+ device, function (err, res, body){
expect(res.statusCode).to.equal(404);
done();
});
});
});
});
describe("testing: "+url+"telegram", function () {
it('should return 302', function (done) {
request({
url: url+"telegram",
followRedirect: false,
maxRedirects: 0
}, function (err, res, body){
expect(res.statusCode).to.equal(302);
done();
redirects.forEach(function (redirect) {
describe("testing: " + url + redirect, function () {
it('should return 302', function (done) {
request({
url: url + redirect,
followRedirect: false,
maxRedirects: 0
}, function (err, res, body){
expect(res.statusCode).to.equal(302);
done();
});
});
});
});
Expand Down
32 changes: 17 additions & 15 deletions test/test_prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ var expect = require('chai').expect;
console.log(1)

var url = 'http://localhost:2701/';
var pages = ["", "apps", "features", "install", "convergence",
"design", "privacy", "devices", "telegram"]
var devices = ["FP2", "bacon", "hammerhead", "cooler", "frieza", "krillin", "vegetahd", "arale", "turbo", "mako"]
var redirects = ["apps", "features", "install", "convergence", "design", "privacy", "devices", "telegram"]
var server;

before((ok) => {
Expand All @@ -20,31 +20,33 @@ before((ok) => {
})

describe("testing "+process.env.NODE_ENV, function () {
pages.forEach(function (page) {
describe("testing: "+url+page, function () {
devices.forEach(function (device) {
describe("testing: " + url + "device/"+ device, function () {
it('should return 200', function (done) {
request.get(url+page, function (err, res, body){
request.get(url + "device/" + device, function (err, res, body){
expect(res.statusCode).to.equal(200);
done();
});
});
it('should return 404', function (done) {
request.post(url+page, function (err, res, body){
request.post(url + "device/" + device, function (err, res, body){
expect(res.statusCode).to.equal(404);
done();
});
});
});
});
describe("testing: "+url+"telegram", function () {
it('should return 302', function (done) {
request({
url: url+"telegram",
followRedirect: false,
maxRedirects: 0
}, function (err, res, body){
expect(res.statusCode).to.equal(302);
done();
redirects.forEach(function (redirect) {
describe("testing: " + url + redirect, function () {
it('should return 302', function (done) {
request({
url: url + redirect,
followRedirect: false,
maxRedirects: 0
}, function (err, res, body){
expect(res.statusCode).to.equal(302);
done();
});
});
});
});
Expand Down

0 comments on commit a26a164

Please sign in to comment.