mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-27 08:10:24 +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 => {
|
export default () => new Promise(resolve => {
|
||||||
const server = createServer();
|
const server = createServer();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ process.on('unhandledRejection', console.dir);
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
const app = require('../built/server/api').default;
|
const app = require('../built/server/api').default;
|
||||||
require('../built/server').default();
|
|
||||||
const db = require('../built/db/mongodb').default;
|
const db = require('../built/db/mongodb').default;
|
||||||
|
|
||||||
const server = http.createServer(app.callback());
|
const server = http.createServer(app.callback());
|
||||||
|
@ -44,6 +43,10 @@ describe('API', () => {
|
||||||
// Reset database each test
|
// Reset database each test
|
||||||
beforeEach(resetDb(db));
|
beforeEach(resetDb(db));
|
||||||
|
|
||||||
|
before(() => {
|
||||||
|
server.close();
|
||||||
|
});
|
||||||
|
|
||||||
describe('signup', () => {
|
describe('signup', () => {
|
||||||
it('不正なユーザー名でアカウントが作成できない', async(async () => {
|
it('不正なユーザー名でアカウントが作成できない', async(async () => {
|
||||||
const res = await request('/signup', {
|
const res = await request('/signup', {
|
||||||
|
|
|
@ -27,13 +27,13 @@ process.on('unhandledRejection', console.dir);
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
const app = require('../built/server/api').default;
|
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 db = require('../built/db/mongodb').default;
|
||||||
|
|
||||||
const server = http.createServer(app.callback());
|
const apiServer = http.createServer(app.callback());
|
||||||
|
|
||||||
//#region Utilities
|
//#region Utilities
|
||||||
const request = _request(server);
|
const request = _request(apiServer);
|
||||||
const signup = _signup(request);
|
const signup = _signup(request);
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
@ -41,6 +41,10 @@ describe('Streaming', () => {
|
||||||
// Reset database each test
|
// Reset database each test
|
||||||
beforeEach(resetDb(db));
|
beforeEach(resetDb(db));
|
||||||
|
|
||||||
|
before(() => {
|
||||||
|
server.close();
|
||||||
|
});
|
||||||
|
|
||||||
it('投稿がタイムラインに流れる', done => {
|
it('投稿がタイムラインに流れる', done => {
|
||||||
const post = {
|
const post = {
|
||||||
text: 'foo'
|
text: 'foo'
|
||||||
|
|
Loading…
Reference in a new issue