mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-28 21:08:52 -07:00
Refactor
This commit is contained in:
parent
e22c816982
commit
059806016b
3 changed files with 5 additions and 8 deletions
|
@ -13,7 +13,6 @@ import * as fs from 'fs';
|
||||||
import * as assert from 'chai';
|
import * as assert from 'chai';
|
||||||
import { async, _signup, _request, _uploadFile, _post, _react, resetDb } from './utils';
|
import { async, _signup, _request, _uploadFile, _post, _react, resetDb } from './utils';
|
||||||
|
|
||||||
assert.use(require('chai-http'));
|
|
||||||
const expect = assert.expect;
|
const expect = assert.expect;
|
||||||
|
|
||||||
//#region process
|
//#region process
|
||||||
|
|
|
@ -10,12 +10,9 @@
|
||||||
|
|
||||||
import * as http from 'http';
|
import * as http from 'http';
|
||||||
import * as WebSocket from 'ws';
|
import * as WebSocket from 'ws';
|
||||||
import * as assert from 'chai';
|
import * as assert from 'assert';
|
||||||
import { _signup, _request, _uploadFile, _post, _react, resetDb } from './utils';
|
import { _signup, _request, _uploadFile, _post, _react, resetDb } from './utils';
|
||||||
|
|
||||||
assert.use(require('chai-http'));
|
|
||||||
const expect = assert.expect;
|
|
||||||
|
|
||||||
//#region process
|
//#region process
|
||||||
Error.stackTraceLimit = Infinity;
|
Error.stackTraceLimit = Infinity;
|
||||||
|
|
||||||
|
@ -59,7 +56,7 @@ describe('Streaming', () => {
|
||||||
const msg = JSON.parse(data.toString());
|
const msg = JSON.parse(data.toString());
|
||||||
if (msg.type == 'channel' && msg.body.id == 'a') {
|
if (msg.type == 'channel' && msg.body.id == 'a') {
|
||||||
if (msg.body.type == 'note') {
|
if (msg.body.type == 'note') {
|
||||||
expect(msg.body.body.text).eql(post.text);
|
assert.deepStrictEqual(msg.body.body.text, post.text);
|
||||||
ws.close();
|
ws.close();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
@ -93,7 +90,7 @@ describe('Streaming', () => {
|
||||||
const msg = JSON.parse(data.toString());
|
const msg = JSON.parse(data.toString());
|
||||||
if (msg.type == 'channel' && msg.body.id == 'a') {
|
if (msg.type == 'channel' && msg.body.id == 'a') {
|
||||||
if (msg.body.type == 'mention') {
|
if (msg.body.type == 'mention') {
|
||||||
expect(msg.body.body.text).eql(aliceNote.text);
|
assert.deepStrictEqual(msg.body.body.text, aliceNote.text);
|
||||||
ws.close();
|
ws.close();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
@ -127,7 +124,7 @@ describe('Streaming', () => {
|
||||||
const msg = JSON.parse(data.toString());
|
const msg = JSON.parse(data.toString());
|
||||||
if (msg.type == 'channel' && msg.body.id == 'a') {
|
if (msg.type == 'channel' && msg.body.id == 'a') {
|
||||||
if (msg.body.type == 'renote') {
|
if (msg.body.type == 'renote') {
|
||||||
expect(msg.body.body.renoteId).eql(bobNote.id);
|
assert.deepStrictEqual(msg.body.body.renoteId, bobNote.id);
|
||||||
ws.close();
|
ws.close();
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as http from 'http';
|
import * as http from 'http';
|
||||||
import * as assert from 'chai';
|
import * as assert from 'chai';
|
||||||
|
assert.use(require('chai-http'));
|
||||||
|
|
||||||
export const async = (fn: Function) => (done: Function) => {
|
export const async = (fn: Function) => (done: Function) => {
|
||||||
fn().then(() => {
|
fn().then(() => {
|
||||||
|
|
Loading…
Reference in a new issue