refactor: split api into api, api-cli & api-plugin

This commit is contained in:
2023-06-02 16:41:25 +02:00
parent 495a63977c
commit b21833de40
205 changed files with 1981 additions and 1492 deletions

View File

@@ -24,8 +24,8 @@ import {expect} from 'chai';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import chaiSpies from 'chai-spies';
import moment from 'moment';
import {HttpClient, Bulk, Client, BulkWithMultipleTypesError} from '../src/index.js';
import {addHours} from 'date-fns';
chai.should();
chai.use(chaiSpies);
@@ -50,9 +50,10 @@ describe('Bulk', function () {
});
expect(client.invokeRoute).not.to.have.been.called();
const expiration = addHours(new Date(), 1).toISOString();
const bulk = new Bulk(SCThingType.Dish, client, {
expiration: moment().add(3600, 'seconds').format(),
expiration,
source: 'foo',
state: 'in progress',
type: SCThingType.Dish,
@@ -63,7 +64,7 @@ describe('Bulk', function () {
categories: ['main dish'],
name: 'foobar',
origin: {
indexed: moment().format(),
indexed: new Date().toISOString(),
name: 'bar',
type: SCThingOriginType.Remote,
},
@@ -84,7 +85,7 @@ describe('Bulk', function () {
it('should fail add', async function () {
const bulk = new Bulk(SCThingType.Dish, client, {
expiration: moment().add(3600, 'seconds').format(),
expiration: addHours(new Date(), 1).toISOString(),
source: 'foo',
state: 'in progress',
type: SCThingType.Dish,
@@ -97,7 +98,7 @@ describe('Bulk', function () {
messageBody: 'Lorem ipsum.',
name: 'foobar',
origin: {
indexed: moment().format(),
indexed: new Date().toISOString(),
name: 'bar',
type: SCThingOriginType.Remote,
},
@@ -111,7 +112,7 @@ describe('Bulk', function () {
it('should construct', function () {
expect(() => {
return new Bulk(SCThingType.Dish, client, {
expiration: moment().add(3600, 'seconds').format(),
expiration: addHours(new Date(), 1).toISOString(),
source: 'foo',
state: 'in progress',
type: SCThingType.Dish,
@@ -128,7 +129,7 @@ describe('Bulk', function () {
expect(client.invokeRoute).not.to.have.been.called();
const bulk = new Bulk(SCThingType.Dish, client, {
expiration: moment().add(3600, 'seconds').format(),
expiration: addHours(new Date(), 1).toISOString(),
source: 'foo',
state: 'in progress',
type: SCThingType.Dish,