aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/tests/apps/overview-test.js
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-10-28 10:25:13 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-10-30 10:46:02 +0100
commit1e5830fb652fda2da6f18460c92f82d93c52130c (patch)
tree8383c08cc17ed71555b1cd8468292968f9bf07f1 /server/sonar-web/tests/apps/overview-test.js
parenta3528799883487e180ce90985e96cf87281e645f (diff)
downloadsonarqube-1e5830fb652fda2da6f18460c92f82d93c52130c.tar.gz
sonarqube-1e5830fb652fda2da6f18460c92f82d93c52130c.zip
SONAR-6331 improve UX of the project overview page
Diffstat (limited to 'server/sonar-web/tests/apps/overview-test.js')
-rw-r--r--server/sonar-web/tests/apps/overview-test.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/server/sonar-web/tests/apps/overview-test.js b/server/sonar-web/tests/apps/overview-test.js
new file mode 100644
index 00000000000..2ba57a13ff5
--- /dev/null
+++ b/server/sonar-web/tests/apps/overview-test.js
@@ -0,0 +1,44 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import TestUtils from 'react-addons-test-utils';
+import { expect } from 'chai';
+
+import Gate from '../../src/main/js/apps/overview/gate/gate';
+import GateConditions from '../../src/main/js/apps/overview/gate/gate-conditions';
+import GateCondition from '../../src/main/js/apps/overview/gate/gate-condition';
+
+describe('Overview', function () {
+
+ describe('Quality Gate', function () {
+ it('should display a badge', function () {
+ let output = TestUtils.renderIntoDocument(<Gate gate={{ level: 'ERROR', conditions: [] }} component={{ }}/>);
+ TestUtils.findRenderedDOMComponentWithClass(output, 'badge-error');
+ });
+
+ it('should not be displayed', function () {
+ let output = TestUtils.renderIntoDocument(<Gate component={{ }}/>);
+ expect(TestUtils.scryRenderedDOMComponentsWithClass(output, 'overview-gate')).to.be.empty;
+ });
+
+ it('should display empty gate', function () {
+ let output = TestUtils.renderIntoDocument(<Gate component={{ qualifier: 'TRK' }}/>);
+ TestUtils.findRenderedDOMComponentWithClass(output, 'overview-gate');
+ TestUtils.findRenderedDOMComponentWithClass(output, 'overview-gate-warning');
+ });
+
+ it('should filter out passed conditions', function () {
+ const conditions = [
+ { level: 'OK' },
+ { level: 'ERROR', metric: { name: 'error metric' } },
+ { level: 'WARN', metric: { name: 'warn metric' } },
+ { level: 'OK' }
+ ];
+
+ let renderer = TestUtils.createRenderer();
+ renderer.render(<GateConditions gate={{ conditions }} component={{}}/>);
+ let output = renderer.getRenderOutput();
+ expect(output.props.children).to.have.length(2);
+ });
+ });
+
+});