aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/tests
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-02-16 16:23:18 +0100
committerStas Vilchik <vilchiks@gmail.com>2016-02-16 16:39:11 +0100
commit87cfb23610eacd370452151210017c045adaa42d (patch)
treef22ad046ec087bf9af808932d501db2992b62d7d /server/sonar-web/tests
parent7d0f619f33a47ea1755e993df0e2084ba2a6f074 (diff)
downloadsonarqube-87cfb23610eacd370452151210017c045adaa42d.tar.gz
sonarqube-87cfb23610eacd370452151210017c045adaa42d.zip
SONAR-7191 Update the background tasks page to reflect latest WS changes
Diffstat (limited to 'server/sonar-web/tests')
-rw-r--r--server/sonar-web/tests/apps/background-tasks-test.js91
1 files changed, 36 insertions, 55 deletions
diff --git a/server/sonar-web/tests/apps/background-tasks-test.js b/server/sonar-web/tests/apps/background-tasks-test.js
index 0d70aa18311..f72e3b41e69 100644
--- a/server/sonar-web/tests/apps/background-tasks-test.js
+++ b/server/sonar-web/tests/apps/background-tasks-test.js
@@ -7,8 +7,8 @@ import Header from '../../src/main/js/apps/background-tasks/components/Header';
import Stats from '../../src/main/js/apps/background-tasks/components/Stats';
import Search from '../../src/main/js/apps/background-tasks/components/Search';
import Tasks from '../../src/main/js/apps/background-tasks/components/Tasks';
-import {STATUSES, CURRENTS, DEBOUNCE_DELAY} from '../../src/main/js/apps/background-tasks/constants';
-import {formatDuration} from '../../src/main/js/apps/background-tasks/helpers';
+import { STATUSES, CURRENTS, DEBOUNCE_DELAY } from '../../src/main/js/apps/background-tasks/constants';
+import { formatDuration } from '../../src/main/js/apps/background-tasks/helpers';
let chai = require('chai');
let expect = chai.expect;
@@ -28,44 +28,37 @@ describe('Background Tasks', function () {
});
});
- describe('Header', () => {
- it('should render', () => {
- let component = TestUtils.renderIntoDocument(<Header/>),
- header = TestUtils.scryRenderedDOMComponentsWithTag(component, 'header');
- expect(header.length).to.equal(1);
- });
- });
-
describe('Search', () => {
it('should render search form', () => {
- let spy = sinon.spy();
- let component = TestUtils.renderIntoDocument(<Search options={{}}
- onStatusChange={spy}
- onCurrentsChange={spy}
- onDateChange={spy}/>),
- searchBox = TestUtils.scryRenderedDOMComponentsWithClass(component, 'search-box');
+ let component = TestUtils.renderIntoDocument(
+ <Search
+ types={[]}
+ date={{}}/>
+ ),
+ searchBox = TestUtils.scryRenderedDOMComponentsWithClass(component, 'js-search');
expect(searchBox).to.have.length(1);
});
it('should not render search form', () => {
- let spy = sinon.spy();
- let component = TestUtils.renderIntoDocument(<Search options={{ component: { id: 'ABCD' } }}
- onStatusChange={spy}
- onCurrentsChange={spy}
- onDateChange={spy}/>),
- searchBox = TestUtils.scryRenderedDOMComponentsWithClass(component, 'search-box');
+ let component = TestUtils.renderIntoDocument(
+ <Search
+ options={{ component: { id: 'ABCD' } }}
+ types={[]}
+ date={{}}/>
+ ),
+ searchBox = TestUtils.scryRenderedDOMComponentsWithClass(component, 'js-search');
expect(searchBox).to.be.empty;
});
it('should search', (done) => {
- let spy = sinon.spy(),
- searchSpy = sinon.spy();
- let component = TestUtils.renderIntoDocument(<Search options={{}}
- onStatusChange={spy}
- onCurrentsChange={spy}
- onDateChange={spy}
- onSearch={searchSpy}/>);
- let searchInput = ReactDOM.findDOMNode(TestUtils.findRenderedDOMComponentWithClass(component, 'search-box-input'));
+ let searchSpy = sinon.spy();
+ let component = TestUtils.renderIntoDocument(
+ <Search
+ types={[]}
+ date={{}}
+ onSearch={searchSpy}/>);
+ let searchInput = ReactDOM.findDOMNode(
+ TestUtils.findRenderedDOMComponentWithClass(component, 'js-search'));
searchInput.value = 'some search query';
TestUtils.Simulate.change(searchInput);
setTimeout(() => {
@@ -75,13 +68,13 @@ describe('Background Tasks', function () {
});
it('should reload', () => {
- let spy = sinon.spy(),
- reloadSpy = sinon.spy();
- let component = TestUtils.renderIntoDocument(<Search options={{}}
- onStatusChange={spy}
- onCurrentsChange={spy}
- onDateChange={spy}
- refresh={reloadSpy}/>);
+ let reloadSpy = sinon.spy();
+ let component = TestUtils.renderIntoDocument(
+ <Search
+ types={[]}
+ date={{}}
+ onRefresh={reloadSpy}/>
+ );
let reloadButton = component.refs.reloadButton;
expect(reloadSpy).to.not.have.been.called;
TestUtils.Simulate.click(reloadButton);
@@ -117,7 +110,7 @@ describe('Background Tasks', function () {
it('should trigger cancelling pending', () => {
let spy = sinon.spy();
- let result = TestUtils.renderIntoDocument(<Stats pendingCount="5" cancelPending={spy}/>),
+ let result = TestUtils.renderIntoDocument(<Stats pendingCount="5" onCancelAllPending={spy}/>),
cancelPending = result.refs.cancelPending;
expect(spy).to.not.have.been.called;
TestUtils.Simulate.click(cancelPending);
@@ -127,32 +120,32 @@ describe('Background Tasks', function () {
describe('Failures', () => {
it('should show zero failures', () => {
- let result = TestUtils.renderIntoDocument(<Stats failuresCount="0"/>),
+ let result = TestUtils.renderIntoDocument(<Stats failingCount="0"/>),
failureCounter = result.refs.failureCount;
expect(failureCounter.textContent).to.contain('0');
});
it('should show 5 failures', () => {
- let result = TestUtils.renderIntoDocument(<Stats failuresCount="5"/>),
+ let result = TestUtils.renderIntoDocument(<Stats failingCount="5"/>),
failureCounter = result.refs.failureCount;
expect(failureCounter.textContent).to.contain('5');
});
it('should not show link to failures', () => {
- let result = TestUtils.renderIntoDocument(<Stats failuresCount="0"/>),
+ let result = TestUtils.renderIntoDocument(<Stats failingCount="0"/>),
failureCounter = result.refs.failureCount;
expect(failureCounter.tagName.toLowerCase()).to.not.equal('a');
});
it('should show link to failures', () => {
- let result = TestUtils.renderIntoDocument(<Stats failuresCount="5"/>),
+ let result = TestUtils.renderIntoDocument(<Stats failingCount="5"/>),
failureCounter = result.refs.failureCount;
expect(failureCounter.tagName.toLowerCase()).to.equal('a');
});
it('should trigger filtering failures', () => {
let spy = sinon.spy();
- let result = TestUtils.renderIntoDocument(<Stats failuresCount="5" showFailures={spy}/>),
+ let result = TestUtils.renderIntoDocument(<Stats failingCount="5" onShowFailing={spy}/>),
failureCounter = result.refs.failureCount;
expect(spy).to.not.have.been.called;
TestUtils.Simulate.click(failureCounter);
@@ -181,18 +174,6 @@ describe('Background Tasks', function () {
});
});
- describe('Tasks', () => {
- it('should show list', () => {
- let tasks = [
- { id: 'a' },
- { id: 'b' },
- { id: 'c' }
- ];
- let result = TestUtils.renderIntoDocument(<Tasks tasks={tasks}/>);
- expect(TestUtils.scryRenderedDOMComponentsWithTag(result, 'tr')).to.have.length(3 + /* table header */ 1);
- });
- });
-
describe('Helpers', () => {
describe('#formatDuration()', () => {
it('should format 173ms', () => {