Skip to content

Commit

Permalink
upgrade JSDOM to 15.2.1
Browse files Browse the repository at this point in the history
- bump RAM allowance for prearchive scripts in Jenkins
  • Loading branch information
erikphansen committed May 19, 2020
1 parent eccb647 commit c72bb11
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 113 deletions.
2 changes: 1 addition & 1 deletion jenkins/common.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def buildAll(String ref, dockerContainer, Boolean contentOnlyBuild) {

def prearchive(dockerContainer, envName) {
dockerContainer.inside(DOCKER_ARGS) {
sh "cd /application && node script/prearchive.js --buildtype=${envName}"
sh "cd /application && node --max-old-space-size=4096 script/prearchive.js --buildtype=${envName}"
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"isomorphic-fetch": "^2.2.1",
"jest": "^23.6.0",
"jest-image-snapshot": "^2.7.0",
"jsdom": "^11.1.0",
"jsdom": "^15.2.1",
"json2csv": "^4.2.1",
"jsonschema": "^1.1.1",
"libxmljs": "^0.19.5",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import sinon from 'sinon';
import { MhvTermsAndConditions } from '../../containers/MhvTermsAndConditions';

describe('<MhvTermsAndConditions>', () => {
let oldLocation;

const props = {
location: {
pathname: '/health-care/medical-information-terms-conditions',
Expand All @@ -30,14 +32,20 @@ describe('<MhvTermsAndConditions>', () => {
};

const setup = () => {
global.window.location.replace = sinon.spy();
oldLocation = global.window.location;
delete global.window.location;
global.window.location = { replace: sinon.spy() };
props.acceptTerms.reset();
props.fetchLatestTerms.reset();
props.fetchTermsAcceptance.reset();
};

beforeEach(setup);

afterEach(() => {
global.window.location = oldLocation;
});

it('should show an error when there are errors', () => {
const newProps = set('errors', { code: 404 }, props);
const wrapper = shallow(<MhvTermsAndConditions {...newProps} />);
Expand Down
7 changes: 4 additions & 3 deletions src/applications/vaos/tests/containers/VAOSApp.unit.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,15 @@ describe('VAOS <VAOSApp>', () => {
},
};

const oldReplace = window.location.replace;
window.location.replace = sinon.spy();
const oldLocation = window.location;
delete window.location;
window.location = { replace: sinon.spy() };
const tree = mount(<VAOSApp showApplication user={user} />);

expect(window.location.replace.firstCall.args[0]).to.contain('verify');
expect(tree.find('RequiredLoginView').exists()).to.be.true;

window.location.replace = oldReplace;
window.location.replace = oldLocation;
tree.unmount();
});
});
13 changes: 12 additions & 1 deletion src/platform/testing/unit/mocha-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,18 @@ export default function setupJSDom() {

win.dataLayer = [];
win.scrollTo = () => {};
win.sessionStorage = {};
Object.defineProperty(win, 'sessionStorage', {
value: global.sessionStorage,
configurable: true,
enumerable: true,
writable: true,
});
Object.defineProperty(win, 'localStorage', {
value: global.localStorage,
configurable: true,
enumerable: true,
writable: true,
});
win.requestAnimationFrame = func => func();
win.matchMedia = () => ({
matches: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import backendServices from '../../../../user/profile/constants/backendServices'
import { MHVApp } from '../../../authorization/containers/MHVApp';

describe('<MHVApp>', () => {
let oldLocation;

const props = {
location: { pathname: '/health-care/prescriptions', query: {} },
mhvAccount: {
Expand All @@ -28,7 +30,11 @@ describe('<MHVApp>', () => {
};

const setup = () => {
global.window.location.replace = sinon.spy();
oldLocation = global.window.location;
delete global.window.location;
global.window.location = {
replace: sinon.spy(),
};
props.createMHVAccount.reset();
props.fetchMHVAccount.reset();
props.upgradeMHVAccount.reset();
Expand All @@ -52,6 +58,10 @@ describe('<MHVApp>', () => {

beforeEach(setup);

afterEach(() => {
global.window.location = oldLocation;
});

it('should show a loading indicator when fetching an account', () => {
const newProps = set('mhvAccount.loading', true, props);
const wrapper = shallow(<MHVApp {...newProps} />, { context });
Expand Down
Loading

0 comments on commit c72bb11

Please sign in to comment.