mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
refactor: build system
This commit is contained in:
@@ -40,9 +40,9 @@ export class CommonSpec {
|
||||
@test
|
||||
testCreateUUID() {
|
||||
const item = {
|
||||
type: 'Not even a thing'
|
||||
type: 'Not even a thing',
|
||||
};
|
||||
expect(createUUID(item,'f-u')).to.equal('3ac2b548-75d3-5326-920a-241e514fe445');
|
||||
expect(createUUID(item, 'f-u')).to.equal('3ac2b548-75d3-5326-920a-241e514fe445');
|
||||
// ID was generated once before!
|
||||
}
|
||||
|
||||
@@ -57,18 +57,14 @@ export class CommonSpec {
|
||||
uid: '744321ca-cc95-4967-b8df-42c98b792db6',
|
||||
};
|
||||
|
||||
nock('http://localhost:3000')
|
||||
.post('/bulk')
|
||||
.reply(200, bulkOpen);
|
||||
nock('http://localhost:3000').post('/bulk').reply(200, bulkOpen);
|
||||
|
||||
const nockBulkAdd = nock('http://localhost:3000')
|
||||
.post('/bulk/744321ca-cc95-4967-b8df-42c98b792db6')
|
||||
.reply(201, {})
|
||||
.persist(); // otherwise consumed!
|
||||
.post('/bulk/744321ca-cc95-4967-b8df-42c98b792db6')
|
||||
.reply(201, {})
|
||||
.persist(); // otherwise consumed!
|
||||
|
||||
nock('http://localhost:3000')
|
||||
.post('/bulk/744321ca-cc95-4967-b8df-42c98b792db6/done')
|
||||
.reply(204, {});
|
||||
nock('http://localhost:3000').post('/bulk/744321ca-cc95-4967-b8df-42c98b792db6/done').reply(204, {});
|
||||
|
||||
// should succeed
|
||||
expect(await CommonSpec.runExecuteConnector()).to.equal(true);
|
||||
@@ -77,17 +73,16 @@ export class CommonSpec {
|
||||
|
||||
// should fail due to nockBulkAdd being consumed
|
||||
expect(await CommonSpec.runExecuteConnector()).to.equal(false);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the connector
|
||||
*/
|
||||
static async runExecuteConnector(): Promise<boolean> {
|
||||
try{
|
||||
await executeConnector('http://localhost:3000', CommonSpec.connector)
|
||||
try {
|
||||
await executeConnector('http://localhost:3000', CommonSpec.connector);
|
||||
return true;
|
||||
}catch(err){
|
||||
} catch (err) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,11 +35,12 @@ export class ConnectorSpec {
|
||||
|
||||
@test
|
||||
async testAutomaticMissingUIDGeneration() {
|
||||
const uuidRegExp = new RegExp('^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$');
|
||||
const uuidRegExp = new RegExp(
|
||||
'^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$',
|
||||
);
|
||||
const messages = await ConnectorSpec.connector.getItems();
|
||||
for(const message of messages){
|
||||
for (const message of messages) {
|
||||
expect(message.uid).to.match(uuidRegExp);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,12 +66,10 @@ export class MinimalConnectorSpec {
|
||||
|
||||
@test
|
||||
getSampleThings() {
|
||||
return MinimalConnectorSpec.connector
|
||||
.getItems()
|
||||
.then(<T extends SCThings>(items: T[]) => {
|
||||
if (items.length > 0) {
|
||||
MinimalConnectorSpec.validateThings(items);
|
||||
}
|
||||
});
|
||||
return MinimalConnectorSpec.connector.getItems().then(<T extends SCThings>(items: T[]) => {
|
||||
if (items.length > 0) {
|
||||
MinimalConnectorSpec.validateThings(items);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user