This repository has been archived by the owner on Apr 30, 2020. It is now read-only.
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
7 changed files
with
207 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
bower_components/ | ||
node_modules/ | ||
artifacts/ | ||
coverage/ | ||
build | ||
npm-debug.log | ||
deploy.json | ||
|
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/*global describe, it*/ | ||
|
||
process.env.NODE_ENV = 'production'; | ||
|
||
var liblayouts = require('../../lib/layouts'); | ||
var expect = require('chai').expect; | ||
|
||
describe('lib/layouts', function () { | ||
var layout; | ||
|
||
describe('load()', function () { | ||
it('returns an array', function (done) { | ||
liblayouts.load(function (err, data) { | ||
if (err) throw err; | ||
expect(data).to.be.an('array'); | ||
expect(data).to.have.length(8); | ||
layout = data[0]; | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('archive()', function () { | ||
it('does something', function () { | ||
var stream = require('stream'); | ||
expect(liblayouts.archive(layout)) | ||
.to.be.an.instanceof(stream.Stream); | ||
}); | ||
}); | ||
}); |
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,44 @@ | ||
/*global describe, it*/ | ||
|
||
process.env.NODE_ENV = 'production'; | ||
|
||
var libutils = require('../../lib/utils'); | ||
var expect = require('chai').expect; | ||
|
||
describe('lib/utils', function () { | ||
describe('error()', function () { | ||
it('constructs an error object', function () { | ||
expect(libutils.error(400)) | ||
.to.be.instanceof(Error) | ||
.and.to.have.property('status') | ||
.that.equals(400); | ||
}); | ||
}); | ||
|
||
describe('extend()', function () { | ||
it('augments an object', function () { | ||
expect(libutils.extend({}, {a: 'foo'}, {b: 'bar'})) | ||
.to.be.an('object') | ||
.and.to.include.keys('a', 'b'); | ||
}); | ||
}); | ||
|
||
describe('passError()', function () { | ||
it('passes an error asynchronously to a callback', function (done) { | ||
libutils.passError(function (reason) { | ||
expect(reason).to.equal('whatever'); | ||
done(); | ||
})('whatever'); | ||
}); | ||
}); | ||
|
||
describe('passValue()', function () { | ||
it('passes a value asynchronously to a callback', function (done) { | ||
libutils.passValue(function (err, value) { | ||
expect(err).to.be.null; | ||
expect(value).to.equal('whatever'); | ||
done(); | ||
})('whatever'); | ||
}); | ||
}); | ||
}); |
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,40 @@ | ||
/*global describe, it*/ | ||
|
||
process.env.NODE_ENV = 'production'; | ||
|
||
var app = require('../../app.js'); | ||
var request = require('supertest'); | ||
var expect = require('chai').expect; | ||
|
||
app.get('/500', function (req, res) { | ||
throw new Error('dummy error'); | ||
}); | ||
|
||
describe('Error cases', function () { | ||
describe('GET /', function () { | ||
it('should respond with 200', function (done) { | ||
request(app).get('/') | ||
.expect(200) | ||
.expect('Content-Type', 'text/html; charset=utf-8') | ||
.end(done); | ||
}); | ||
}); | ||
|
||
describe('GET /404', function () { | ||
it('should respond with 404', function (done) { | ||
request(app).get('/404') | ||
.expect(404) | ||
.expect('Content-Type', 'text/html; charset=UTF-8') | ||
.end(done); | ||
}); | ||
}); | ||
|
||
describe('GET /500', function () { | ||
it('should respond with 500', function (done) { | ||
request(app).get('/500') | ||
.expect(500) | ||
.expect('Content-Type', 'text/html; charset=UTF-8') | ||
.end(done); | ||
}); | ||
}); | ||
}); |
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,39 @@ | ||
/*global describe, it*/ | ||
|
||
process.env.NODE_ENV = 'production'; | ||
|
||
var express = require('express'); | ||
var layouts = require('../../routes/layouts'); | ||
var request = require('supertest'); | ||
var expect = require('chai').expect; | ||
|
||
var app = require('../../app'); | ||
|
||
describe('routes/layouts', function () { | ||
describe('/layouts/', function () { | ||
it('should return 200', function (done) { | ||
request(app).get('/layouts/') | ||
.expect(200) | ||
.expect('Content-Type', 'text/html; charset=utf-8') | ||
.end(done); | ||
}); | ||
}); | ||
|
||
describe('/layouts/blog/', function () { | ||
it('should return 200', function (done) { | ||
request(app).get('/layouts/blog/') | ||
.expect(200) | ||
.expect('Content-Type', 'text/html; charset=utf-8') | ||
.end(done); | ||
}); | ||
}); | ||
|
||
describe('/layouts/blog/download', function () { | ||
it('should trigger the download of a layout', function (done) { | ||
request(app).get('/layouts/blog/download') | ||
.expect(200) | ||
.expect('Content-Disposition', 'attachment; filename="pure-layout-blog.zip"') | ||
.end(done); | ||
}); | ||
}); | ||
}); |
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,48 @@ | ||
/*global describe, it*/ | ||
|
||
process.env.NODE_ENV = 'production'; | ||
|
||
var express = require('express'); | ||
var layouts = require('../../routes/start'); | ||
var request = require('supertest'); | ||
var expect = require('chai').expect; | ||
|
||
var app = require('../../app'); | ||
|
||
describe('routes/start', function () { | ||
describe('/start/', function () { | ||
it('should return 200', function (done) { | ||
request(app).get('/start/') | ||
.expect(200) | ||
.expect('Content-Type', 'text/html; charset=utf-8') | ||
.end(done); | ||
}); | ||
}); | ||
|
||
describe('/start/css?mq=100', function () { | ||
it('should return some JSON content', function (done) { | ||
request(app).get('/start/css?mq=100') | ||
.expect(200) | ||
.expect('Content-Type', 'application/json; charset=utf-8') | ||
.end(done); | ||
}); | ||
}); | ||
|
||
describe('/start/css?mq=foo bar', function () { | ||
it('should return 400', function (done) { | ||
request(app).get('/start/css?mq=foo bar') | ||
.expect(400) | ||
.expect('Content-Type', 'text/html; charset=UTF-8') | ||
.end(done); | ||
}); | ||
}); | ||
|
||
describe('/start/download', function () { | ||
it('should trigger the download of the starter kit', function (done) { | ||
request(app).get('/start/download') | ||
.expect(200) | ||
.expect('Content-Disposition', 'attachment; filename="pure-start.zip"') | ||
.end(done); | ||
}); | ||
}); | ||
}); |