mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-13 17:30:45 +01:00
Fix test
This commit is contained in:
parent
931f17c589
commit
4d24741d48
3 changed files with 24 additions and 4 deletions
|
@ -101,6 +101,19 @@ function createServer() {
|
|||
}
|
||||
}
|
||||
|
||||
// For testing
|
||||
export const startServer = () => {
|
||||
const server = createServer();
|
||||
|
||||
// Init stream server
|
||||
require('./api/streaming')(server);
|
||||
|
||||
// Listen
|
||||
server.listen(config.port);
|
||||
|
||||
return server;
|
||||
};
|
||||
|
||||
export default () => new Promise(resolve => {
|
||||
const server = createServer();
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ process.on('unhandledRejection', console.dir);
|
|||
//#endregion
|
||||
|
||||
const app = require('../built/server/api').default;
|
||||
require('../built/server').default();
|
||||
const db = require('../built/db/mongodb').default;
|
||||
|
||||
const server = http.createServer(app.callback());
|
||||
|
@ -44,6 +43,10 @@ describe('API', () => {
|
|||
// Reset database each test
|
||||
beforeEach(resetDb(db));
|
||||
|
||||
before(() => {
|
||||
server.close();
|
||||
});
|
||||
|
||||
describe('signup', () => {
|
||||
it('不正なユーザー名でアカウントが作成できない', async(async () => {
|
||||
const res = await request('/signup', {
|
||||
|
|
|
@ -27,13 +27,13 @@ process.on('unhandledRejection', console.dir);
|
|||
//#endregion
|
||||
|
||||
const app = require('../built/server/api').default;
|
||||
require('../built/server').default();
|
||||
const server = require('../built/server').startServer();
|
||||
const db = require('../built/db/mongodb').default;
|
||||
|
||||
const server = http.createServer(app.callback());
|
||||
const apiServer = http.createServer(app.callback());
|
||||
|
||||
//#region Utilities
|
||||
const request = _request(server);
|
||||
const request = _request(apiServer);
|
||||
const signup = _signup(request);
|
||||
//#endregion
|
||||
|
||||
|
@ -41,6 +41,10 @@ describe('Streaming', () => {
|
|||
// Reset database each test
|
||||
beforeEach(resetDb(db));
|
||||
|
||||
before(() => {
|
||||
server.close();
|
||||
});
|
||||
|
||||
it('投稿がタイムラインに流れる', done => {
|
||||
const post = {
|
||||
text: 'foo'
|
||||
|
|
Loading…
Reference in a new issue