mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-10 03:32:52 +00:00
feat: migrate backend to cosmiconfig
This commit is contained in:
@@ -42,7 +42,7 @@ describe('Bulk', function () {
|
||||
|
||||
afterEach(function () {
|
||||
sandbox.restore();
|
||||
})
|
||||
});
|
||||
|
||||
it('should add', async function () {
|
||||
sandbox.on(client, 'invokeRoute', () => {
|
||||
|
||||
@@ -35,10 +35,17 @@ import chaiSpies from 'chai-spies';
|
||||
import clone = require('rfdc');
|
||||
import moment from 'moment';
|
||||
import traverse from 'traverse';
|
||||
import {ConnectorClient, EmptyBulkError, NamespaceNotDefinedError, HttpClient, HttpClientRequest, HttpClientResponse} from '../src/index.js';
|
||||
import path from "path";
|
||||
import {fileURLToPath} from "url";
|
||||
import {readdir, readFile} from "fs/promises";
|
||||
import {
|
||||
ConnectorClient,
|
||||
EmptyBulkError,
|
||||
NamespaceNotDefinedError,
|
||||
HttpClient,
|
||||
HttpClientRequest,
|
||||
HttpClientResponse,
|
||||
} from '../src/index.js';
|
||||
import path from 'path';
|
||||
import {fileURLToPath} from 'url';
|
||||
import {readdir, readFile} from 'fs/promises';
|
||||
|
||||
chai.should();
|
||||
chai.use(chaiSpies);
|
||||
@@ -333,7 +340,7 @@ describe('ConnectorClient', function () {
|
||||
expect(ConnectorClient.makeUUID('foo', 'f-u')).not.to.be.equal(uuid);
|
||||
});
|
||||
|
||||
it('should fail making a uuid', async function (){
|
||||
it('should fail making a uuid', async function () {
|
||||
expect(() => {
|
||||
ConnectorClient.makeUUID('foo', 'b-u');
|
||||
}).to.throw(NamespaceNotDefinedError);
|
||||
@@ -353,12 +360,14 @@ describe('ConnectorClient', function () {
|
||||
|
||||
const testFiles = await readdir(pathToTestFiles);
|
||||
|
||||
const testInstances = await Promise.all(testFiles.map(async testFile => {
|
||||
const buffer = await readFile(path.join(pathToTestFiles, testFile));
|
||||
const content = JSON.parse(buffer.toString());
|
||||
const testInstances = await Promise.all(
|
||||
testFiles.map(async testFile => {
|
||||
const buffer = await readFile(path.join(pathToTestFiles, testFile));
|
||||
const content = JSON.parse(buffer.toString());
|
||||
|
||||
return content.instance;
|
||||
}));
|
||||
return content.instance;
|
||||
}),
|
||||
);
|
||||
|
||||
for (const testInstance of testInstances) {
|
||||
const checkInstance = clone()(testInstance);
|
||||
|
||||
@@ -33,9 +33,9 @@ import {createFileSync} from 'fs-extra';
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations
|
||||
import {e2eRun, getItemsFromSamples, ApiError, HttpClient, RequestOptions, Response} from '../src/index.js';
|
||||
import {RecursivePartial} from './client.spec.js';
|
||||
import {expect} from "chai";
|
||||
import path from "path";
|
||||
import {fileURLToPath} from "url";
|
||||
import {expect} from 'chai';
|
||||
import path from 'path';
|
||||
import {fileURLToPath} from 'url';
|
||||
|
||||
chai.should();
|
||||
chai.use(chaiSpies);
|
||||
@@ -184,14 +184,18 @@ describe('e2e Connector', function () {
|
||||
if (!existsSync(emptyDirectoryPath)) {
|
||||
mkdirSync(emptyDirectoryPath);
|
||||
}
|
||||
await e2eRun(httpClient, {to: 'http://localhost', samplesLocation: emptyDirectoryPath}).should.be.rejectedWith(
|
||||
'Could not index samples. None were retrieved from the file system.',
|
||||
);
|
||||
await e2eRun(httpClient, {
|
||||
to: 'http://localhost',
|
||||
samplesLocation: emptyDirectoryPath,
|
||||
}).should.be.rejectedWith('Could not index samples. None were retrieved from the file system.');
|
||||
rmdirSync(emptyDirectoryPath);
|
||||
});
|
||||
|
||||
it('should fail to index directory without json data', async function () {
|
||||
const somewhatFilledDirectoryPath = path.join(path.dirname(fileURLToPath(import.meta.url)), 'somewhatFilledDir');
|
||||
const somewhatFilledDirectoryPath = path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
'somewhatFilledDir',
|
||||
);
|
||||
if (!existsSync(somewhatFilledDirectoryPath)) {
|
||||
mkdirSync(somewhatFilledDirectoryPath);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import {HttpClient} from '../src/index.js';
|
||||
describe('HttpClient', function () {
|
||||
afterEach(function () {
|
||||
nock.cleanAll();
|
||||
})
|
||||
});
|
||||
|
||||
it('should construct', function () {
|
||||
expect(() => {
|
||||
|
||||
@@ -19,9 +19,9 @@ import {expect} from 'chai';
|
||||
import chaiSpies from 'chai-spies';
|
||||
import {HttpClient} from '../src/index.js';
|
||||
import {TestPlugin} from './plugin-resources/test-plugin.js';
|
||||
import path from "path";
|
||||
import {readFile} from "fs/promises";
|
||||
import {fileURLToPath} from "url";
|
||||
import path from 'path';
|
||||
import {readFile} from 'fs/promises';
|
||||
import {fileURLToPath} from 'url';
|
||||
|
||||
chai.use(chaiSpies);
|
||||
|
||||
@@ -56,12 +56,12 @@ describe('Plugin', function () {
|
||||
'',
|
||||
'',
|
||||
);
|
||||
})
|
||||
});
|
||||
|
||||
afterEach(async function () {
|
||||
await testPlugin.close();
|
||||
sandbox.restore();
|
||||
})
|
||||
});
|
||||
|
||||
it('should construct', async function () {
|
||||
const converter = new Converter(
|
||||
|
||||
Reference in New Issue
Block a user