This repository has been archived by the owner on Dec 17, 2022. 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.
Merge branch 'dev/remove.doubleshot'
- Loading branch information
Showing
5 changed files
with
112 additions
and
128 deletions.
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 |
---|---|---|
@@ -1,9 +1,16 @@ | ||
language: node_js | ||
node_js: | ||
- "4.0" | ||
- "0.12" | ||
- "0.11" | ||
- "0.10" | ||
- "0.8" | ||
- "0.6" | ||
matrix: | ||
allow_failures: | ||
- node_js: "0.11" | ||
|
||
before_install: | ||
# Upgrade npm to avoid semver issues | ||
- curl --location http://rawgit.com/twolfson/fix-travis-ci/master/lib/install.sh | bash -s | ||
|
||
notifications: | ||
email: false |
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 was deleted.
Oops, something went wrong.
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,98 @@ | ||
// Load in dependencies | ||
var spawn = require('child_process').spawn, | ||
request = require('request'), | ||
expect = require('chai').expect; | ||
|
||
var testUtils = { | ||
spawn: function (cmd, args, options) { | ||
before(function spawnChildProcess (done) { | ||
// Start up a child server | ||
this.child = spawn(cmd, args, options); | ||
|
||
// After it loads, callback | ||
setTimeout(done, 1000); | ||
}); | ||
after(function killChildProcess (done) { | ||
// Kill the child process | ||
var child = this.child; | ||
delete this.child; | ||
child.kill(); | ||
|
||
// When it leaves, callback | ||
child.on('exit', function (code) { | ||
done(); | ||
}); | ||
}); | ||
}, | ||
request: function (url) { | ||
before(function requestFn (done) { | ||
var that = this; | ||
request(url, function handleResponse (err, res, body) { | ||
// Save the error, response, and body | ||
that.err = err; | ||
that.res = res; | ||
that.body = body; | ||
|
||
// Callback with the error | ||
done(err); | ||
}); | ||
}); | ||
after(function cleanup () { | ||
delete this.err; | ||
delete this.res; | ||
delete this.body; | ||
}); | ||
} | ||
}; | ||
|
||
describe('jojo', function () { | ||
describe('run via CLI', function () { | ||
testUtils.spawn('node', ['../../../bin/jojo'], { | ||
cwd: __dirname + '/test_files/cli' | ||
}); | ||
|
||
testUtils.request('http://localhost:11550/1900-05-17-the-wonderful-wizard-of-oz'); | ||
it('serves articles', function () { | ||
expect(this.body).to.contain('<h1>The Wonderful Wizard of Oz</h1>'); | ||
}); | ||
}); | ||
|
||
describe('integrated into a server', function () { | ||
testUtils.spawn('node', ['app.js'], { | ||
cwd: __dirname + '/test_files/integrated' | ||
}); | ||
|
||
describe('with response to an index page', function () { | ||
testUtils.request('http://localhost:11550/'); | ||
it('serves an index page', function () { | ||
expect(this.body).to.contain('<section id="articles">'); | ||
expect(this.body).to.contain('the-wonderful-wizard-of-oz'); | ||
}); | ||
}); | ||
|
||
describe('with respect to articles', function () { | ||
testUtils.request('http://localhost:11550/1900-05-17-the-wonderful-wizard-of-oz'); | ||
it('serves articles', function () { | ||
expect(this.body).to.contain('<h1>The Wonderful Wizard of Oz</h1>'); | ||
}); | ||
}); | ||
|
||
describe('with response to RSS', function () { | ||
testUtils.request('http://localhost:11550/index.xml'); | ||
it('serves an RSS feed', function () { | ||
expect(this.body).to.contain('<id>/1900-05-17-the-wonderful-wizard-of-oz</id>'); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('jojo running with no articles', function () { | ||
testUtils.spawn('node', ['app.js'], { | ||
cwd: __dirname + '/test_files/empty_app' | ||
}); | ||
|
||
testUtils.request('http://localhost:11550/'); | ||
it('serves content', function () { | ||
expect(this.body).to.contain('<section id="articles">'); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.