replace with custom superagent based on fetch API
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
const common = require('./common.js'),
|
||||
constants = require('../../constants.js'),
|
||||
expect = require('expect.js'),
|
||||
superagent = require('superagent');
|
||||
superagent = require('../../superagent.js');
|
||||
|
||||
describe('Updater API', function () {
|
||||
const { setup, cleanup, serverUrl, owner } = common;
|
||||
@@ -20,7 +20,7 @@ describe('Updater API', function () {
|
||||
it('can get app auto update pattern (default)', async function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/updater/autoupdate_pattern`)
|
||||
.query({ access_token: owner.token });
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body.pattern).to.be.ok();
|
||||
});
|
||||
|
||||
@@ -28,20 +28,20 @@ describe('Updater API', function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/updater/autoupdate_pattern`)
|
||||
.query({ access_token: owner.token })
|
||||
.ok(() => true);
|
||||
expect(response.statusCode).to.equal(400);
|
||||
expect(response.status).to.equal(400);
|
||||
});
|
||||
|
||||
it('can set autoupdate_pattern', async function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/updater/autoupdate_pattern`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ pattern: '00 30 11 * * 1-5' });
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.status).to.equal(200);
|
||||
});
|
||||
|
||||
it('can get auto update pattern', async function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/updater/autoupdate_pattern`)
|
||||
.query({ access_token: owner.token });
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body.pattern).to.be('00 30 11 * * 1-5');
|
||||
});
|
||||
|
||||
@@ -49,13 +49,13 @@ describe('Updater API', function () {
|
||||
const response = await superagent.post(`${serverUrl}/api/v1/updater/autoupdate_pattern`)
|
||||
.query({ access_token: owner.token })
|
||||
.send({ pattern: constants.AUTOUPDATE_PATTERN_NEVER });
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.status).to.equal(200);
|
||||
});
|
||||
|
||||
it('can get auto update pattern', async function () {
|
||||
const response = await superagent.get(`${serverUrl}/api/v1/updater/autoupdate_pattern`)
|
||||
.query({ access_token: owner.token });
|
||||
expect(response.statusCode).to.equal(200);
|
||||
expect(response.status).to.equal(200);
|
||||
expect(response.body.pattern).to.be(constants.AUTOUPDATE_PATTERN_NEVER);
|
||||
});
|
||||
|
||||
@@ -64,7 +64,7 @@ describe('Updater API', function () {
|
||||
.query({ access_token: owner.token })
|
||||
.send({ pattern: '1 3 x 5 6' })
|
||||
.ok(() => true);
|
||||
expect(response.statusCode).to.equal(400);
|
||||
expect(response.status).to.equal(400);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user