Skip to content

Commit

Permalink
chore(deps): Upgrade testing frameworks and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoffan committed Jul 25, 2019
1 parent 04253ce commit ed6341c
Show file tree
Hide file tree
Showing 5 changed files with 353 additions and 193 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"husky": "^1.3.1",
"i18n-webpack-plugin": "^1.0.0",
"jsuri": "^1.3.1",
"karma": "^3.1.4",
"karma": "^4.2.0",
"karma-chai": "^0.1.0",
"karma-chai-dom": "^1.1.0",
"karma-chrome-launcher": "^2.2.0",
Expand All @@ -74,7 +74,7 @@
"lint-staged": "^8.0.4",
"lodash": "^4.17.11",
"mini-css-extract-plugin": "^0.8.0",
"mocha": "^4.0.1",
"mocha": "^6.2.0",
"mock-local-storage": "^1.0.2",
"mojito-rb-gen": "^0.0.1",
"node-noop": "^1.0.0",
Expand All @@ -91,7 +91,7 @@
"react-dom": "^16.7.0",
"react-virtualized": "^9.13.0",
"sass-loader": "^7.1.0",
"sinon": "^7.2.3",
"sinon": "^7.3.2",
"sinon-chai": "3.3.0",
"string-replace-loader": "^2.2.0",
"style-loader": "^0.23.1",
Expand Down
9 changes: 5 additions & 4 deletions src/lib/PreviewError.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class PreviewError extends Error {
* @param {string} code - Error code
* @param {string} [displayMessage] - Translated error message that can be displayed to a user
* @param {Object} [details] - Optional error options
* @param {...Object} [params] - Additional params, this may contain the original error message
* @param {string} [message] - Original error message
* @param {...Object} [params] - Additional params
* @return {PreviewError} PreviewError instance
*/
constructor(code, displayMessage = '', details = {}, ...params) {
constructor(code, displayMessage = '', details = {}, message, ...params) {
// Pass remaining arguments to parent constructor
super(...params);
super(message, ...params);

// Workaround to make `instanceof PreviewError` work in ES5
this.constructor = PreviewError;
Expand All @@ -41,7 +42,7 @@ class PreviewError extends Error {
this.displayMessage = displayMessage || __('error_generic');

// Default base error message to display message if not set - some code may depend on Error.message
this.message = this.message || this.displayMessage;
this.message = message || this.displayMessage;
}
}

Expand Down
5 changes: 0 additions & 5 deletions src/lib/__tests__/Preview-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1209,11 +1209,6 @@ describe('lib/Preview', () => {
};
});

it('should use the saved preview options', () => {
preview.parseOptions(preview.previewOptions);
expect(stubs.assign).to.be.calledWith(preview.previewOptions);
});

it('should set the container', () => {
preview.parseOptions(preview.previewOptions);
expect(preview.options.container).to.equal(containerEl);
Expand Down
8 changes: 6 additions & 2 deletions src/lib/viewers/doc/__tests__/PresentationPreloader-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ describe('lib/viewers/doc/PresentationPreloader', () => {
preloader = new PresentationPreloader({
hideLoadingIndicator: () => {},
});
stubs = {};
preloader.previewUI = {
hideLoadingIndicator: sandbox.stub(),
};
stubs = {
hideLoadingIndicator: preloader.previewUI.hideLoadingIndicator,
};
});

afterEach(() => {
Expand All @@ -30,7 +35,6 @@ describe('lib/viewers/doc/PresentationPreloader', () => {
stubs.checkDocumentLoaded = sandbox.stub(preloader, 'checkDocumentLoaded');
stubs.emit = sandbox.stub(preloader, 'emit');
stubs.setDimensions = sandbox.stub(util, 'setDimensions');
stubs.hideLoadingIndicator = sandbox.stub(preloader.previewUI, 'hideLoadingIndicator');
preloader.imageEl = {};
preloader.preloadEl = document.createElement('div');
});
Expand Down
Loading

0 comments on commit ed6341c

Please sign in to comment.