test: add hypercube error test (#466)

This commit is contained in:
Miralem Drek
2020-07-01 10:51:47 +02:00
committed by GitHub
parent edbf8d8819
commit 60c68672c8
4 changed files with 28 additions and 8 deletions

View File

@@ -31,7 +31,7 @@ const useEngine = ({ ACCEPT_EULA = false, cwd = path.resolve(__dirname, '../'),
if (ACCEPT_EULA !== true) {
throw new Error('Need to accept EULA in order to start engine container');
}
console.error('Starting engine container...', cwd);
console.error('Starting engine container...');
const f = (files || []).reduce((acc, curr) => [...acc, '-f', curr], []);
process.env.ACCEPT_EULA = 'yes';
const stopEngine = async () => {

View File

@@ -65,7 +65,7 @@ if (engine) {
});
},
stop: async () => {
await e();
e && (await e());
},
});
}
@@ -75,7 +75,7 @@ function cleanup() {
return;
}
hasCleanedUp = true;
console.log('Stopping services');
console.log('> Stopping services');
services.forEach(async (service) => {
console.log(`${service.name}`);
await service.stop();
@@ -83,16 +83,16 @@ function cleanup() {
}
async function run() {
console.log('Starting services');
console.log('> Starting services');
try {
services.forEach(async (service) => {
for await (const service of services) {
console.log(`${service.name}`);
await service.start();
});
console.log('All up and running');
}
console.log('> All up and running');
} catch (err) {
console.log(err);
console.error(`\x1b[31m${JSON.stringify(err)}\x1b[0m`);
cleanup();
throw err;
}

View File

@@ -32,6 +32,11 @@ describe('object lifecycle', () => {
await waitForTextStatus('[data-tid="error-title"]', 'The calculation condition is not fulfilled');
});
it('should render error when a hypercube contains a qError', async () => {
await page.click('button[data-phase="hypercube-error"]');
await waitForTextStatus('[data-tid="error-title"]', 'Error');
});
it('should render when requirements are fulfilled', async () => {
await page.click('button[data-phase="fulfill-requirements"]');
await waitForTextStatus('.rendered', 'Success!');

View File

@@ -22,6 +22,15 @@ const calcCond = {
},
};
const cubeError = {
...baseProps,
qHyperCubeDef: {
qMode: 'S',
qMeasures: [{}],
qInterColumnSortOrder: [-2],
},
};
const fulfilled = {
...baseProps,
qHyperCubeDef: {
@@ -112,6 +121,12 @@ export default function phases({ app }) {
obj.setProperties(calcCond);
},
},
{
name: 'Hypercube error',
action: () => {
obj.setProperties(cubeError);
},
},
{
name: 'Fulfill requirements',
action: () => {