mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
feat: tests
This commit is contained in:
@@ -27,12 +27,9 @@ import {
|
||||
import chai from 'chai';
|
||||
import chaiAsPromised from 'chai-as-promised';
|
||||
import chaiSpies from 'chai-spies';
|
||||
import {suite, test} from '@testdeck/mocha';
|
||||
import moment from 'moment';
|
||||
import {copy} from '../src/copy.js';
|
||||
import {ApiError} from '../src/errors.js';
|
||||
import {HttpClient, RequestOptions, Response} from '../src/http-client.js';
|
||||
import {RecursivePartial} from './client.spec';
|
||||
import {copy, ApiError, HttpClient, RequestOptions, Response} from '../src/index.js';
|
||||
import {RecursivePartial} from './client.spec.js';
|
||||
|
||||
chai.should();
|
||||
chai.use(chaiSpies);
|
||||
@@ -47,14 +44,12 @@ const searchRoute = new SCSearchRoute();
|
||||
|
||||
const httpClient = new HttpClient();
|
||||
|
||||
@suite()
|
||||
export class CopySpec {
|
||||
async after() {
|
||||
describe('Copy', function () {
|
||||
afterEach(function () {
|
||||
sandbox.restore();
|
||||
}
|
||||
});
|
||||
|
||||
@test
|
||||
async copy() {
|
||||
it('should copy', async function () {
|
||||
type responses = Response<SCBulkAddResponse | SCBulkDoneResponse | SCBulkResponse | SCSearchResponse>;
|
||||
|
||||
sandbox.on(
|
||||
@@ -133,10 +128,9 @@ export class CopySpec {
|
||||
type: SCThingType.Dish,
|
||||
version: 'foo.bar.foobar',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@test
|
||||
async copyShouldFail() {
|
||||
it('should fail to copy', async function () {
|
||||
type responses = Response<SCBulkAddResponse | SCBulkDoneResponse | SCBulkResponse | SCSearchResponse>;
|
||||
|
||||
sandbox.on(
|
||||
@@ -206,7 +200,7 @@ export class CopySpec {
|
||||
},
|
||||
);
|
||||
|
||||
return copy(httpClient, {
|
||||
await copy(httpClient, {
|
||||
batchSize: 5,
|
||||
from: 'http://foo.bar',
|
||||
source: 'stapps-copy',
|
||||
@@ -214,5 +208,5 @@ export class CopySpec {
|
||||
type: SCThingType.Dish,
|
||||
version: 'foo.bar.foobar',
|
||||
}).should.be.rejectedWith(ApiError);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user