Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
spyOn(__internals__, 'isReferenceParameter').andCall(({ reference }) => !!reference)
spyOn(__internals__, 'getJSONSchemaFromReferenceParameter')
.andCall(({ reference }) => reference)
const inputs = [
[ { simple: 123 }, false ],
[ { sequence: 234 }, false ],
[ { array: 345 }, false ],
[ { reference: 456 }, false ],
[ { other: 567 }, false ]
]
const expected = [
123, 234, 345, 456, {}
]
const actual = inputs.map(input => __internals__.getRawJSONSchema(...input))
expect(actual).toEqual(expected)
})
/* eslint-enable max-statements */
it('should display data in percentage format with 2-decimal precision', () => {
const primitive = [[{t: 'n', z: 4, f: '=SUM(2:2)'}]];
const sheet = buildSheetFromMatrix(primitive);
expect(sheet.A1.t).toBe('n');
expect(sheet.A1.f).toBe('=SUM(2:2)');
expect(sheet.A1.z).toBe('#,##0.00');
});
});
it('Computes max', () => {
const max = summarize(mixedArray, 'max');
expect(max).toBe(20);
});
it('Computes mean', () => {
it('should return the defined state', () => {
const state = {foo: 'bar'};
expect(reducer(state, {type: null})).toEqual(state);
});
});
it('deals with expressions returning scene parts', () => {
const sceneText = 'YAY!';
const nextSceneId = 'sceneD';
const sceneDesc = {
content: ['seq',
['text', sceneText],
buildGotoOptionExpression(nextSceneId)
]
};
context.scenes[sceneId] = sceneDesc;
reportError = expect.spyOn(context, 'reportError');
let { scene, dynamicState: newDynamicState } = evaluateScene(sceneId, dynamicState, context);
expect(reportError).toNotHaveBeenCalled();
expect(scene.text).toEqual(sceneText);
expect(scene.options).toEqual([
{text: 'Go to ' + nextSceneId, action: 'goto', parameters: [nextSceneId]}
]);
expect(scene.desc).toEqual(sceneDesc);
expect(newDynamicState).toBe(dynamicState);
});
});
it('should call inferType if type if not standard', () => {
const param = new Parameter({ type: 'double' })
const schema = {}
spyOn(__internals__, 'inferType').andReturn('number')
const expected = {
type: 'number'
}
const actual = __internals__.addTypeFromParameterToSchema(param, schema)
expect(__internals__.inferType).toHaveBeenCalled()
expect(actual).toEqual(expected)
})
.then(system => {
const allErrors = system.errSelectors.allErrors().toJS()
expect(allErrors.length).toEqual(1)
const firstError = allErrors[0]
expect(firstError.path).toEqual(["paths", "/", "get", "security", "0", "0"])
expect(firstError.message).toMatch("Security scope definition write:pets could not be resolved")
})
})
let storeWithBug = createStore(
counterWithBug,
instrument(undefined, { maxAge: 3, shouldCatchErrors: true })
);
let liftedStoreWithBug = storeWithBug.liftedStore;
storeWithBug.dispatch({ type: 'DECREMENT' });
storeWithBug.dispatch({ type: 'DECREMENT' });
storeWithBug.dispatch({ type: 'DECREMENT' });
storeWithBug.dispatch({ type: 'DECREMENT' });
let liftedStoreState = liftedStoreWithBug.getState();
let currentComputedState = liftedStoreState.computedStates[liftedStoreState.currentStateIndex];
expect(liftedStoreState.currentStateIndex).toBe(4);
expect(currentComputedState.state).toBe(0);
expect(currentComputedState.error).toExist();
spy.restore();
});
const ngReduxStore = mockStore((action) => {
dispatches++;
expect(action.type).toEqual('@@NGREDUX_PASSTHROUGH');
if (action.payload) {
expect(action.payload).toEqual('TEST DISPATCH');
}
});
it('pauses the media when paused', () => {
const { store } = setup(jPlayers);
store.dispatch(pause(id));
expect(mockCurrentMedia.pause).toHaveBeenCalled();
});