mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 05:17:39 -07:00
Fix test
This commit is contained in:
parent
56105a5530
commit
7fceaa4553
1 changed files with 5 additions and 5 deletions
10
test/api.ts
10
test/api.ts
|
@ -2,7 +2,9 @@
|
||||||
* API TESTS
|
* API TESTS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import * as fs from 'fs';
|
||||||
import * as merge from 'object-assign-deep';
|
import * as merge from 'object-assign-deep';
|
||||||
|
import * as chai from 'chai';
|
||||||
|
|
||||||
Error.stackTraceLimit = Infinity;
|
Error.stackTraceLimit = Infinity;
|
||||||
|
|
||||||
|
@ -12,11 +14,9 @@ process.env.NODE_ENV = 'test';
|
||||||
// Display detail of unhandled promise rejection
|
// Display detail of unhandled promise rejection
|
||||||
process.on('unhandledRejection', console.dir);
|
process.on('unhandledRejection', console.dir);
|
||||||
|
|
||||||
const fs = require('fs');
|
|
||||||
const _chai = require('chai');
|
|
||||||
const chaiHttp = require('chai-http');
|
const chaiHttp = require('chai-http');
|
||||||
|
|
||||||
_chai.use(chaiHttp);
|
chai.use(chaiHttp);
|
||||||
|
|
||||||
const server = require('../built/server/api').callback();
|
const server = require('../built/server/api').callback();
|
||||||
const db = require('../built/db/mongodb').default;
|
const db = require('../built/db/mongodb').default;
|
||||||
|
@ -34,7 +34,7 @@ const request = (endpoint, params, me?) => new Promise<any>((ok, ng) => {
|
||||||
i: me.token
|
i: me.token
|
||||||
} : {};
|
} : {};
|
||||||
|
|
||||||
_chai.request(server)
|
chai.request(server)
|
||||||
.post(endpoint)
|
.post(endpoint)
|
||||||
.send(Object.assign(auth, params))
|
.send(Object.assign(auth, params))
|
||||||
.end((err, res) => {
|
.end((err, res) => {
|
||||||
|
@ -723,7 +723,7 @@ describe('API', () => {
|
||||||
describe('drive/files/create', () => {
|
describe('drive/files/create', () => {
|
||||||
it('ファイルを作成できる', async(async () => {
|
it('ファイルを作成できる', async(async () => {
|
||||||
const me = await insertSakurako();
|
const me = await insertSakurako();
|
||||||
const res = await _chai.request(server)
|
const res = await chai.request(server)
|
||||||
.post('/drive/files/create')
|
.post('/drive/files/create')
|
||||||
.field('i', me.token)
|
.field('i', me.token)
|
||||||
.attach('file', fs.readFileSync(__dirname + '/resources/Lenna.png'), 'Lenna.png');
|
.attach('file', fs.readFileSync(__dirname + '/resources/Lenna.png'), 'Lenna.png');
|
||||||
|
|
Loading…
Reference in a new issue