Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #2521 - Add new module tests - Implements new `test-module` task to specifically run module tests
- Loading branch information
Showing
2 changed files
with
76 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
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,60 @@ | ||
/*global describe, it */ | ||
/*jshint expr:true*/ | ||
// # Module tests | ||
// This tests using Ghost as an npm module | ||
var should = require('should'), | ||
|
||
ghost = require('../../../../core'); | ||
|
||
describe('Module', function () { | ||
describe('Setup', function () { | ||
it('should resolve with a ghost-server instance', function (done) { | ||
ghost().then(function (ghostServer) { | ||
should.exist(ghostServer); | ||
|
||
done(); | ||
}).catch(function (e) { | ||
done(e); | ||
}); | ||
}); | ||
|
||
it('should expose an express instance', function (done) { | ||
ghost().then(function (ghostServer) { | ||
should.exist(ghostServer); | ||
should.exist(ghostServer.rootApp); | ||
|
||
done(); | ||
}).catch(function (e) { | ||
done(e); | ||
}); | ||
}); | ||
|
||
it('should expose configuration values', function (done) { | ||
ghost().then(function (ghostServer) { | ||
should.exist(ghostServer); | ||
should.exist(ghostServer.config); | ||
should.exist(ghostServer.config.server); | ||
should.exist(ghostServer.config.paths); | ||
should.exist(ghostServer.config.paths.subdir); | ||
should.equal(ghostServer.config.paths.subdir, ''); | ||
|
||
done(); | ||
}).catch(function (e) { | ||
done(e); | ||
}); | ||
}); | ||
|
||
it('should have start/stop/restart functions', function (done) { | ||
ghost().then(function (ghostServer) { | ||
should.exist(ghostServer); | ||
ghostServer.start.should.be.a.Function; | ||
ghostServer.restart.should.be.a.Function; | ||
ghostServer.stop.should.be.a.Function; | ||
|
||
done(); | ||
}).catch(function (e) { | ||
done(e); | ||
}); | ||
}); | ||
}); | ||
}); |