Skip to content

Commit

Permalink
Revert "chore: fix test for long running query"
Browse files Browse the repository at this point in the history
This reverts commit 331b238.
  • Loading branch information
Caele committed Mar 16, 2022
1 parent 331b238 commit 97b2de7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 142 deletions.
9 changes: 4 additions & 5 deletions apis/enigma-mocker/src/mocks/get-object-mock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getPropValue, getPropFn } from '../prop';
import { findAsync } from '../util';

/**
* Properties on `getObject()` operating synchronously.
Expand All @@ -12,7 +13,6 @@ const PROPS_SYNC = [
'removeAllListeners',
'removeListener',
'setMaxListerners',
'qId',
];

/**
Expand All @@ -30,7 +30,7 @@ function isPropAsync(name) {
* @returns The mocked object
*/
function createMock(genericObject) {
const { id, session, delay = 0, ...props } = genericObject;
const { id, session, ...props } = genericObject;
return {
id: getPropValue(id, { defaultValue: `object - ${+Date.now()}` }),
session: getPropValue(session, { defaultValue: true }),
Expand All @@ -39,7 +39,7 @@ function createMock(genericObject) {
...Object.entries(props).reduce(
(fns, [name, value]) => ({
...fns,
[name]: getPropFn(value, { async: isPropAsync(name), delay }),
[name]: getPropFn(value, { async: isPropAsync(name) }),
}),
{}
),
Expand All @@ -63,7 +63,6 @@ function validate(genericObject) {
if (!(layout.qInfo && layout.qInfo.qId)) {
throw new Error('Generic object is missing "qId" for path "getLayout().qInfo.qId"');
}
genericObject.qId = layout.qInfo.qId; // eslint-disable-line no-param-reassign
}

/**
Expand All @@ -76,7 +75,7 @@ function GetObjectMock(genericObjects = []) {
const genericObjectMocks = genericObjects.map(createMock);

return async (id) => {
const mock = genericObjectMocks.find((m) => m.qId() === id);
const mock = findAsync(genericObjectMocks, async (m) => (await m.getLayout()).qInfo.qId === id);
return Promise.resolve(mock);
};
}
Expand Down
8 changes: 2 additions & 6 deletions apis/enigma-mocker/src/prop.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,8 @@ export const getPropValue = (prop, { args = [], defaultValue } = {}) => {
* @returns A fixture property function
*/
export const getPropFn =
(prop, { defaultValue, async = true, delay = 0 } = {}) =>
(prop, { defaultValue, async = true } = {}) =>
(...args) => {
const value = getPropValue(prop, { defaultValue, args });
return async
? new Promise((resolve) => {
setTimeout(() => resolve(value), delay);
})
: value;
return async ? Promise.resolve(value) : value;
};
4 changes: 2 additions & 2 deletions apis/nucleus/src/components/LongRunningQuery.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function Cancel({ cancel, translator, ...props }) {
<Progress />
</Grid>
<Grid item>
<Typography variant="h6" align="center" data-tid="update-active">
<Typography variant="h6" align="center">
{translator.get('Object.Update.Active')}
</Typography>
</Grid>
Expand All @@ -52,7 +52,7 @@ export function Retry({ retry, translator, ...props }) {
<WarningTriangle style={{ fontSize: '38px' }} />
</Grid>
<Grid item>
<Typography variant="h6" align="center" data-tid="update-cancelled">
<Typography variant="h6" align="center">
{translator.get('Object.Update.Cancelled')}
</Typography>
</Grid>
Expand Down
15 changes: 0 additions & 15 deletions test/mashup/visualize/life.int.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,6 @@ describe('object lifecycle', () => {
await waitForTextStatus('[data-tid="error-title"]', 'Incomplete visualization');
});

it('should render long running query', async () => {
const url = getScenarioUrl('long-running');
await page.goto(url);
await waitForTextStatus('[data-tid="update-active"]', 'Updating data');

// the cancel button should appear after 2000ms
await page.click('.njs-cell button');
await waitForTextStatus('[data-tid="update-cancelled"]', 'Data update was cancelled');
// Retry
await waitForTextStatus('.njs-cell button', 'Retry');
await page.click('.njs-cell button');

await waitForTextStatus('.rendered', 'Success!', { timeout: 7000 });
});

// need to fix calc condition view first
it('should show calculation unfulfilled', async () => {
const url = getScenarioUrl('calc-unfulfilled');
Expand Down
114 changes: 0 additions & 114 deletions test/mashup/visualize/scenarios.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,120 +36,6 @@ scenarios['valid-type'] = {
},
};

scenarios['long-running'] = {
name: 'Long running query',
genericObject: {
delay: 5000,
session: {
getObjectApi() {
return {
cancelRequest() {
return {};
},
};
},
},
getLayout() {
return {
qInfo: {
qId: 'bb8',
qType: 'doesnt matter',
},
qMeta: {
privileges: ['read', 'update', 'delete', 'exportdata'],
},
qSelectionInfo: {},
visualization: 'my-chart',
qHyperCube: {
qSize: {
qcx: 2,
qcy: 1,
},
qDimensionInfo: [
{
qFallbackTitle: '=a',
qApprMaxGlyphCount: 1,
qCardinal: 0,
qSortIndicator: 'N',
qGroupFallbackTitles: ['=a'],
qGroupPos: 0,
qStateCounts: {
qLocked: 0,
qSelected: 0,
qOption: 0,
qDeselected: 0,
qAlternative: 0,
qExcluded: 0,
qSelectedExcluded: 0,
qLockedExcluded: 0,
},
qTags: [],
qDimensionType: 'D',
qGrouping: 'N',
qNumFormat: {
qType: 'U',
qnDec: 0,
qUseThou: 0,
},
qIsAutoFormat: true,
qGroupFieldDefs: ['=a'],
qMin: 'NaN',
qMax: 'NaN',
qAttrExprInfo: [],
qAttrDimInfo: [],
qIsCalculated: true,
qCardinalities: {
qCardinal: 0,
qHypercubeCardinal: 1,
qAllValuesCardinal: -1,
},
},
],
qMeasureInfo: [
{
qFallbackTitle: '=1',
qApprMaxGlyphCount: 1,
qCardinal: 0,
qSortIndicator: 'N',
qNumFormat: {
qType: 'U',
qnDec: 0,
qUseThou: 0,
},
qMin: 1,
qMax: 1,
qIsAutoFormat: true,
qAttrExprInfo: [],
qAttrDimInfo: [],
qTrendLines: [],
},
],
qEffectiveInterColumnSortOrder: [0, 1],
qGrandTotalRow: [
{
qText: '1',
qNum: 1,
qElemNumber: -1,
qState: 'X',
qIsTotalCell: true,
},
],
qDataPages: [],
qPivotDataPages: [],
qStackedDataPages: [],
qMode: 'S',
qNoOfLeftDims: -1,
qTreeNodesOnDim: [],
qColumnOrder: [],
},
};
},
getProperties() {
return {};
},
},
};

scenarios['calc-unfulfilled'] = {
name: 'Calculations unfulfilled',
genericObject: {
Expand Down

0 comments on commit 97b2de7

Please sign in to comment.