From 439865184171791bb7784d78e9a9b7b4285df6e7 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 25 Jan 2019 19:37:45 +0900 Subject: [PATCH] Refactor --- test/api.ts | 1 - test/streaming.ts | 11 ++++------- test/utils.ts | 1 + 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/test/api.ts b/test/api.ts index 67edf3dfc7..77eb2d741b 100644 --- a/test/api.ts +++ b/test/api.ts @@ -13,7 +13,6 @@ import * as fs from 'fs'; import * as assert from 'chai'; import { async, _signup, _request, _uploadFile, _post, _react, resetDb } from './utils'; -assert.use(require('chai-http')); const expect = assert.expect; //#region process diff --git a/test/streaming.ts b/test/streaming.ts index 19cae8c9c0..500324d520 100644 --- a/test/streaming.ts +++ b/test/streaming.ts @@ -10,12 +10,9 @@ import * as http from 'http'; import * as WebSocket from 'ws'; -import * as assert from 'chai'; +import * as assert from 'assert'; import { _signup, _request, _uploadFile, _post, _react, resetDb } from './utils'; -assert.use(require('chai-http')); -const expect = assert.expect; - //#region process Error.stackTraceLimit = Infinity; @@ -59,7 +56,7 @@ describe('Streaming', () => { const msg = JSON.parse(data.toString()); if (msg.type == 'channel' && msg.body.id == 'a') { if (msg.body.type == 'note') { - expect(msg.body.body.text).eql(post.text); + assert.deepStrictEqual(msg.body.body.text, post.text); ws.close(); done(); } @@ -93,7 +90,7 @@ describe('Streaming', () => { const msg = JSON.parse(data.toString()); if (msg.type == 'channel' && msg.body.id == 'a') { if (msg.body.type == 'mention') { - expect(msg.body.body.text).eql(aliceNote.text); + assert.deepStrictEqual(msg.body.body.text, aliceNote.text); ws.close(); done(); } @@ -127,7 +124,7 @@ describe('Streaming', () => { const msg = JSON.parse(data.toString()); if (msg.type == 'channel' && msg.body.id == 'a') { if (msg.body.type == 'renote') { - expect(msg.body.body.renoteId).eql(bobNote.id); + assert.deepStrictEqual(msg.body.body.renoteId, bobNote.id); ws.close(); done(); } diff --git a/test/utils.ts b/test/utils.ts index 06fc1e4051..1377122478 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -1,6 +1,7 @@ import * as fs from 'fs'; import * as http from 'http'; import * as assert from 'chai'; +assert.use(require('chai-http')); export const async = (fn: Function) => (done: Function) => { fn().then(() => {