Parcourir la source

use enzyme-to-json serializer (#1483)

tags/6.3-RC1
Stas Vilchik il y a 7 ans
Parent
révision
546e2fbf12

+ 3
- 0
server/sonar-web/package.json Voir le fichier

@@ -119,6 +119,9 @@
"<rootDir>/config/polyfills.js",
"<rootDir>/config/jest/SetupTestEnvironment.js"
],
"snapshotSerializers": [
"enzyme-to-json/serializer"
],
"testPathIgnorePatterns": [
"<rootDir>/node_modules",
"<rootDir>/src/main/webapp",

+ 1
- 2
server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMenu-test.js Voir le fichier

@@ -19,7 +19,6 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
import toJSON from 'enzyme-to-json';
import ComponentNavMenu from '../ComponentNavMenu';

it('should work with extensions', () => {
@@ -29,5 +28,5 @@ it('should work with extensions', () => {
extensions: [{ id: 'foo', name: 'Foo' }]
};
const wrapper = shallow(<ComponentNavMenu component={component} conf={conf}/>);
expect(toJSON(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

+ 1
- 2
server/sonar-web/src/main/js/app/components/nav/global/__tests__/GlobalNavMenu-test.js Voir le fichier

@@ -19,7 +19,6 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
import toJSON from 'enzyme-to-json';
import GlobalNavMenu from '../GlobalNavMenu';

it('should work with extensions', () => {
@@ -31,5 +30,5 @@ it('should work with extensions', () => {
permissions: { global: [] }
};
const wrapper = shallow(<GlobalNavMenu appState={appState} currentUser={currentUser}/>);
expect(toJSON(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

+ 1
- 2
server/sonar-web/src/main/js/app/components/nav/settings/__tests__/SettingsNav-test.js Voir le fichier

@@ -19,11 +19,10 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
import toJSON from 'enzyme-to-json';
import SettingsNav from '../SettingsNav';

it('should work with extensions', () => {
const extensions = [{ id: 'foo', name: 'Foo' }];
const wrapper = shallow(<SettingsNav extensions={extensions}/>);
expect(toJSON(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

+ 3
- 4
server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCardMeasures-test.js Voir le fichier

@@ -19,7 +19,6 @@
*/
import React from 'react';
import { shallow } from 'enzyme';
import toJSON from 'enzyme-to-json';
import ProjectCardMeasures from '../ProjectCardMeasures';

it('should not render coverage', () => {
@@ -32,7 +31,7 @@ it('should not render coverage', () => {
'sqale_rating': '1.0'
};
const wrapper = shallow(<ProjectCardMeasures measures={measures}/>);
expect(toJSON(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

it('should not render duplications', () => {
@@ -45,7 +44,7 @@ it('should not render duplications', () => {
'sqale_rating': '1.0'
};
const wrapper = shallow(<ProjectCardMeasures measures={measures}/>);
expect(toJSON(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

it('should not render ncloc', () => {
@@ -58,5 +57,5 @@ it('should not render ncloc', () => {
'sqale_rating': '1.0'
};
const wrapper = shallow(<ProjectCardMeasures measures={measures}/>);
expect(toJSON(wrapper)).toMatchSnapshot();
expect(wrapper).toMatchSnapshot();
});

Chargement…
Annuler
Enregistrer