summaryrefslogtreecommitdiffstats
path: root/server/sonar-web/test
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-09-25 17:08:50 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-09-30 10:18:55 +0200
commita9a4c04df49c8ae0eb94898701fb151b8e722768 (patch)
tree60554cd57a6871b47f7d5b6c42960111cf7045e1 /server/sonar-web/test
parent3e8b829a8b43f1c023cf90375edb50ba49f8e7b9 (diff)
downloadsonarqube-a9a4c04df49c8ae0eb94898701fb151b8e722768.tar.gz
sonarqube-a9a4c04df49c8ae0eb94898701fb151b8e722768.zip
use nvm to install node.js 4, add mocha tests
Diffstat (limited to 'server/sonar-web/test')
-rw-r--r--server/sonar-web/test/intern.js25
-rw-r--r--server/sonar-web/test/unit/application.spec.js247
-rw-r--r--server/sonar-web/test/unit/code-with-issue-locations-helper.spec.js62
-rw-r--r--server/sonar-web/test/unit/issue.spec.js179
-rw-r--r--server/sonar-web/test/unit/nav/component/component-nav-breadcrumbs.spec.js27
5 files changed, 18 insertions, 522 deletions
diff --git a/server/sonar-web/test/intern.js b/server/sonar-web/test/intern.js
index 70273be7ead..20e008b1e2a 100644
--- a/server/sonar-web/test/intern.js
+++ b/server/sonar-web/test/intern.js
@@ -14,14 +14,25 @@ define(['intern'], function (intern) {
{ id: 'LcovHtml', directory: 'target/web-tests' }
],
- suites: [
- 'test/unit/application.spec',
- 'test/unit/issue.spec',
- 'test/unit/code-with-issue-locations-helper.spec',
- 'test/unit/nav/component/component-nav-breadcrumbs.spec'
- ],
+ suites: [],
- functionalSuites: [],
+ functionalSuites: [
+ 'test/medium/api-documentation.spec',
+ 'test/medium/coding-rules.spec',
+ 'test/medium/computation.spec',
+ 'test/medium/custom-measures.spec',
+ 'test/medium/global-permissions.spec',
+ 'test/medium/groups.spec',
+ 'test/medium/issues.spec',
+ 'test/medium/maintenance.spec',
+ 'test/medium/metrics.spec',
+ 'test/medium/project-permissions.spec',
+ 'test/medium/quality-gates.spec',
+ 'test/medium/quality-profiles.spec',
+ 'test/medium/source-viewer.spec',
+ 'test/medium/update-center.spec',
+ 'test/medium/users.spec'
+ ],
tunnel: tunnel,
environments: [
diff --git a/server/sonar-web/test/unit/application.spec.js b/server/sonar-web/test/unit/application.spec.js
deleted file mode 100644
index b3f7e76c433..00000000000
--- a/server/sonar-web/test/unit/application.spec.js
+++ /dev/null
@@ -1,247 +0,0 @@
-define(function (require) {
- var bdd = require('intern!bdd');
- var assert = require('intern/chai!assert');
-
- require('intern/order!build/js/libs/translate.js');
- require('intern/order!build/js/libs/third-party/jquery.js');
- require('intern/order!build/js/libs/third-party/underscore.js');
- require('intern/order!build/js/libs/third-party/keymaster.js');
- require('intern/order!build/js/libs/third-party/numeral.js');
- require('intern/order!build/js/libs/third-party/numeral-languages.js');
- require('intern/order!build/js/libs/application.js');
-
- bdd.describe('Application', function () {
- bdd.describe('#collapsedDirFromPath()', function () {
- bdd.it('should return null when pass null', function () {
- assert.isNull(window.collapsedDirFromPath(null));
- });
-
- bdd.it('should return "/" when pass "/"', function () {
- assert.equal(window.collapsedDirFromPath('/'), '/');
- });
-
- bdd.it('should not cut short path', function () {
- assert.equal(window.collapsedDirFromPath('src/main/js/components/state.js'), 'src/main/js/components/');
- });
-
- bdd.it('should cut long path', function () {
- assert.equal(window.collapsedDirFromPath('src/main/js/components/navigator/app/models/state.js'),
- 'src/.../js/components/navigator/app/models/');
- });
-
- bdd.it('should cut very long path', function () {
- assert.equal(window.collapsedDirFromPath('src/main/another/js/components/navigator/app/models/state.js'),
- 'src/.../js/components/navigator/app/models/');
- });
- });
-
- bdd.describe('#fileFromPath()', function () {
- bdd.it('should return null when pass null', function () {
- assert.isNull(window.fileFromPath(null));
- });
-
- bdd.it('should return empty string when pass "/"', function () {
- assert.equal(window.fileFromPath('/'), '');
- });
-
- bdd.it('should return file name when pass only file name', function () {
- assert.equal(window.fileFromPath('file.js'), 'file.js');
- });
-
- bdd.it('should return file name when pass file path', function () {
- assert.equal(window.fileFromPath('src/main/js/file.js'), 'file.js');
- });
-
- bdd.it('should return file name when pass file name without extension', function () {
- assert.equal(window.fileFromPath('src/main/file'), 'file');
- });
- });
-
- bdd.describe('Measures', function () {
- var HOURS_IN_DAY = 8,
- ONE_MINUTE = 1,
- ONE_HOUR = ONE_MINUTE * 60,
- ONE_DAY = HOURS_IN_DAY * ONE_HOUR;
-
- bdd.before(function () {
- window.messages = {
- 'work_duration.x_days': '{0}d',
- 'work_duration.x_hours': '{0}h',
- 'work_duration.x_minutes': '{0}min',
- 'work_duration.about': '~ {0}'
- };
- window.SS = { hoursInDay: HOURS_IN_DAY };
- });
-
- bdd.describe('#formatMeasure()', function () {
- bdd.it('should format INT', function () {
- assert.equal(window.formatMeasure(0, 'INT'), '0');
- assert.equal(window.formatMeasure(1, 'INT'), '1');
- assert.equal(window.formatMeasure(-5, 'INT'), '-5');
- assert.equal(window.formatMeasure(999, 'INT'), '999');
- assert.equal(window.formatMeasure(1000, 'INT'), '1,000');
- assert.equal(window.formatMeasure(1529, 'INT'), '1,529');
- assert.equal(window.formatMeasure(10000, 'INT'), '10,000');
- assert.equal(window.formatMeasure(1234567890, 'INT'), '1,234,567,890');
- });
-
- bdd.it('should format SHORT_INT', function () {
- assert.equal(window.formatMeasure(0, 'SHORT_INT'), '0');
- assert.equal(window.formatMeasure(1, 'SHORT_INT'), '1');
- assert.equal(window.formatMeasure(999, 'SHORT_INT'), '999');
- assert.equal(window.formatMeasure(1000, 'SHORT_INT'), '1k');
- assert.equal(window.formatMeasure(1529, 'SHORT_INT'), '1.5k');
- assert.equal(window.formatMeasure(10000, 'SHORT_INT'), '10k');
- assert.equal(window.formatMeasure(10678, 'SHORT_INT'), '11k');
- assert.equal(window.formatMeasure(1234567890, 'SHORT_INT'), '1b');
- });
-
- bdd.it('should format FLOAT', function () {
- assert.equal(window.formatMeasure(0.0, 'FLOAT'), '0.0');
- assert.equal(window.formatMeasure(1.0, 'FLOAT'), '1.0');
- assert.equal(window.formatMeasure(1.3, 'FLOAT'), '1.3');
- assert.equal(window.formatMeasure(1.34, 'FLOAT'), '1.3');
- assert.equal(window.formatMeasure(50.89, 'FLOAT'), '50.9');
- assert.equal(window.formatMeasure(100.0, 'FLOAT'), '100.0');
- assert.equal(window.formatMeasure(123.456, 'FLOAT'), '123.5');
- assert.equal(window.formatMeasure(123456.7, 'FLOAT'), '123,456.7');
- assert.equal(window.formatMeasure(1234567890.0, 'FLOAT'), '1,234,567,890.0');
- });
-
- bdd.it('should format PERCENT', function () {
- assert.equal(window.formatMeasure(0.0, 'PERCENT'), '0.0%');
- assert.equal(window.formatMeasure(1.0, 'PERCENT'), '1.0%');
- assert.equal(window.formatMeasure(1.3, 'PERCENT'), '1.3%');
- assert.equal(window.formatMeasure(1.34, 'PERCENT'), '1.3%');
- assert.equal(window.formatMeasure(50.89, 'PERCENT'), '50.9%');
- assert.equal(window.formatMeasure(100.0, 'PERCENT'), '100.0%');
- });
-
- bdd.it('should format WORK_DUR', function () {
- assert.equal(window.formatMeasure(0, 'WORK_DUR'), '0');
- assert.equal(window.formatMeasure(5 * ONE_DAY, 'WORK_DUR'), '5d');
- assert.equal(window.formatMeasure(2 * ONE_HOUR, 'WORK_DUR'), '2h');
- assert.equal(window.formatMeasure(ONE_MINUTE, 'WORK_DUR'), '1min');
- assert.equal(window.formatMeasure(5 * ONE_DAY + 2 * ONE_HOUR, 'WORK_DUR'), '5d 2h');
- assert.equal(window.formatMeasure(2 * ONE_HOUR + ONE_MINUTE, 'WORK_DUR'), '2h 1min');
- assert.equal(window.formatMeasure(5 * ONE_DAY + 2 * ONE_HOUR + ONE_MINUTE, 'WORK_DUR'), '5d 2h');
- assert.equal(window.formatMeasure(15 * ONE_DAY + 2 * ONE_HOUR + ONE_MINUTE, 'WORK_DUR'), '15d');
- assert.equal(window.formatMeasure(-5 * ONE_DAY, 'WORK_DUR'), '-5d');
- assert.equal(window.formatMeasure(-2 * ONE_HOUR, 'WORK_DUR'), '-2h');
- assert.equal(window.formatMeasure(-1 * ONE_MINUTE, 'WORK_DUR'), '-1min');
- });
-
- bdd.it('should format SHORT_WORK_DUR', function () {
- assert.equal(window.formatMeasure(0, 'SHORT_WORK_DUR'), '0');
- assert.equal(window.formatMeasure(5 * ONE_DAY, 'SHORT_WORK_DUR'), '5d');
- assert.equal(window.formatMeasure(2 * ONE_HOUR, 'SHORT_WORK_DUR'), '2h');
- assert.equal(window.formatMeasure(ONE_MINUTE, 'SHORT_WORK_DUR'), '1min');
- assert.equal(window.formatMeasure(5 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR'), '~ 5d');
- assert.equal(window.formatMeasure(2 * ONE_HOUR + ONE_MINUTE, 'SHORT_WORK_DUR'), '~ 2h');
- assert.equal(window.formatMeasure(5 * ONE_DAY + 2 * ONE_HOUR + ONE_MINUTE, 'SHORT_WORK_DUR'), '~ 5d');
- assert.equal(window.formatMeasure(15 * ONE_DAY + 2 * ONE_HOUR + ONE_MINUTE, 'SHORT_WORK_DUR'), '~ 15d');
- assert.equal(window.formatMeasure(7 * ONE_MINUTE, 'SHORT_WORK_DUR'), '7min');
- assert.equal(window.formatMeasure(-5 * ONE_DAY, 'SHORT_WORK_DUR'), '-5d');
- assert.equal(window.formatMeasure(-2 * ONE_HOUR, 'SHORT_WORK_DUR'), '-2h');
- assert.equal(window.formatMeasure(-1 * ONE_MINUTE, 'SHORT_WORK_DUR'), '-1min');
-
- assert.equal(window.formatMeasure(1529 * ONE_DAY, 'SHORT_WORK_DUR'), '1.5kd');
- assert.equal(window.formatMeasure(1234567 * ONE_DAY, 'SHORT_WORK_DUR'), '1md');
- assert.equal(window.formatMeasure(1234567 * ONE_DAY + 2 * ONE_HOUR, 'SHORT_WORK_DUR'), '1md');
- });
-
- bdd.it('should format RATING', function () {
- assert.equal(window.formatMeasure(1, 'RATING'), 'A');
- assert.equal(window.formatMeasure(2, 'RATING'), 'B');
- assert.equal(window.formatMeasure(3, 'RATING'), 'C');
- assert.equal(window.formatMeasure(4, 'RATING'), 'D');
- assert.equal(window.formatMeasure(5, 'RATING'), 'E');
- });
-
- bdd.it('should not format unknown type', function () {
- assert.equal(window.formatMeasure('random value', 'RANDOM_TYPE'), 'random value');
- });
-
- bdd.it('should not fail without parameters', function () {
- assert.isNull(window.formatMeasure());
- });
- });
-
- bdd.describe('#formatMeasureVariation()', function () {
- bdd.it('should format INT', function () {
- assert.equal(window.formatMeasureVariation(0, 'INT'), '0');
- assert.equal(window.formatMeasureVariation(1, 'INT'), '+1');
- assert.equal(window.formatMeasureVariation(-1, 'INT'), '-1');
- assert.equal(window.formatMeasureVariation(1529, 'INT'), '+1,529');
- assert.equal(window.formatMeasureVariation(-1529, 'INT'), '-1,529');
- });
-
- bdd.it('should format SHORT_INT', function () {
- assert.equal(window.formatMeasureVariation(0, 'SHORT_INT'), '0');
- assert.equal(window.formatMeasureVariation(1, 'SHORT_INT'), '+1');
- assert.equal(window.formatMeasureVariation(-1, 'SHORT_INT'), '-1');
- assert.equal(window.formatMeasureVariation(1529, 'SHORT_INT'), '+1.5k');
- assert.equal(window.formatMeasureVariation(-1529, 'SHORT_INT'), '-1.5k');
- assert.equal(window.formatMeasureVariation(10678, 'SHORT_INT'), '+11k');
- assert.equal(window.formatMeasureVariation(-10678, 'SHORT_INT'), '-11k');
- });
-
- bdd.it('should format FLOAT', function () {
- assert.equal(window.formatMeasureVariation(0.0, 'FLOAT'), '0');
- assert.equal(window.formatMeasureVariation(1.0, 'FLOAT'), '+1.0');
- assert.equal(window.formatMeasureVariation(-1.0, 'FLOAT'), '-1.0');
- assert.equal(window.formatMeasureVariation(50.89, 'FLOAT'), '+50.9');
- assert.equal(window.formatMeasureVariation(-50.89, 'FLOAT'), '-50.9');
- });
-
- bdd.it('should format PERCENT', function () {
- assert.equal(window.formatMeasureVariation(0.0, 'PERCENT'), '0%');
- assert.equal(window.formatMeasureVariation(1.0, 'PERCENT'), '+1.0%');
- assert.equal(window.formatMeasureVariation(-1.0, 'PERCENT'), '-1.0%');
- assert.equal(window.formatMeasureVariation(50.89, 'PERCENT'), '+50.9%');
- assert.equal(window.formatMeasureVariation(-50.89, 'PERCENT'), '-50.9%');
- });
-
- bdd.it('should format WORK_DUR', function () {
- assert.equal(window.formatMeasureVariation(0, 'WORK_DUR'), '0');
- assert.equal(window.formatMeasureVariation(5 * ONE_DAY, 'WORK_DUR'), '+5d');
- assert.equal(window.formatMeasureVariation(2 * ONE_HOUR, 'WORK_DUR'), '+2h');
- assert.equal(window.formatMeasureVariation(ONE_MINUTE, 'WORK_DUR'), '+1min');
- assert.equal(window.formatMeasureVariation(-5 * ONE_DAY, 'WORK_DUR'), '-5d');
- assert.equal(window.formatMeasureVariation(-2 * ONE_HOUR, 'WORK_DUR'), '-2h');
- assert.equal(window.formatMeasureVariation(-1 * ONE_MINUTE, 'WORK_DUR'), '-1min');
- });
-
- bdd.it('should not format unknown type', function () {
- assert.equal(window.formatMeasureVariation('random value', 'RANDOM_TYPE'), 'random value');
- });
-
- bdd.it('should not fail without parameters', function () {
- assert.isNull(window.formatMeasureVariation());
- });
- });
- });
-
- bdd.describe('Severity Comparators', function () {
- bdd.describe('#severityComparator', function () {
- bdd.it('should have correct order', function () {
- assert.equal(window.severityComparator('BLOCKER'), 0);
- assert.equal(window.severityComparator('CRITICAL'), 1);
- assert.equal(window.severityComparator('MAJOR'), 2);
- assert.equal(window.severityComparator('MINOR'), 3);
- assert.equal(window.severityComparator('INFO'), 4);
- });
- });
-
- bdd.describe('#severityColumnsComparator', function () {
- bdd.it('should have correct order', function () {
- assert.equal(window.severityColumnsComparator('BLOCKER'), 0);
- assert.equal(window.severityColumnsComparator('CRITICAL'), 2);
- assert.equal(window.severityColumnsComparator('MAJOR'), 4);
- assert.equal(window.severityColumnsComparator('MINOR'), 1);
- assert.equal(window.severityColumnsComparator('INFO'), 3);
- });
- });
- });
- });
-});
diff --git a/server/sonar-web/test/unit/code-with-issue-locations-helper.spec.js b/server/sonar-web/test/unit/code-with-issue-locations-helper.spec.js
deleted file mode 100644
index 7c3938c2d86..00000000000
--- a/server/sonar-web/test/unit/code-with-issue-locations-helper.spec.js
+++ /dev/null
@@ -1,62 +0,0 @@
-define(function (require) {
- var bdd = require('intern!bdd');
- var assert = require('intern/chai!assert');
-
- var helper = require('build/js/components/source-viewer/helpers/code-with-issue-locations-helper');
-
- bdd.describe('Code With Issue Locations Helper', function () {
- bdd.it('should exist', function () {
- assert.equal(typeof helper, 'function');
- });
-
- bdd.it('should mark one location', function () {
- var code = '<span class="k">if</span> (<span class="sym-2 sym">a</span> + <span class="c">1</span>) {',
- locations = [{ from: 1, to: 5 }],
- result = helper(code, locations, 'x');
- assert.equal(result,
- '<span class="k">i</span><span class="k x">f</span><span class=" x"> (</span><span class="sym-2 sym x">a</span><span class=""> + </span><span class="c">1</span><span class="">) {</span>');
- });
-
- bdd.it('should mark two locations', function () {
- var code = 'abcdefghijklmnopqrst',
- locations = [
- { from: 1, to: 6 },
- { from: 11, to: 16 }
- ],
- result = helper(code, locations, 'x');
- assert.equal(result,
- ['<span class="">a</span>',
- '<span class=" x">bcdef</span>',
- '<span class="">ghijk</span>',
- '<span class=" x">lmnop</span>',
- '<span class="">qrst</span>'].join(''));
- });
-
- bdd.it('should mark one locations', function () {
- var code = '<span class="cppd"> * Copyright (C) 2008-2014 SonarSource</span>',
- locations = [{ from: 15, to: 20 }],
- result = helper(code, locations, 'x');
- assert.equal(result,
- '<span class="cppd"> * Copyright (C</span><span class="cppd x">) 200</span><span class="cppd">8-2014 SonarSource</span>');
- });
-
- bdd.it('should mark two locations', function () {
- var code = '<span class="cppd"> * Copyright (C) 2008-2014 SonarSource</span>',
- locations = [
- { from: 24, to: 29 },
- { from: 15, to: 20 }
- ],
- result = helper(code, locations, 'x');
- assert.equal(result,
- '<span class="cppd"> * Copyright (C</span><span class="cppd x">) 200</span><span class="cppd">8-20</span><span class="cppd x">14 So</span><span class="cppd">narSource</span>');
- // <span class="cppd"> * Copyright (C</span><span class="cppd x">) 200</span><span class="cppd">8-20</span><span class="cppd x">4 So</span><span class="cppd">narSource</span>
- });
-
- bdd.it('should parse line with < and >', function () {
- var code = '<span class="j">#include &lt;stdio.h&gt;</span>',
- result = helper(code, []);
- assert.equal(result, '<span class="j">#include &lt;stdio.h&gt;</span>');
- });
- });
-});
-
diff --git a/server/sonar-web/test/unit/issue.spec.js b/server/sonar-web/test/unit/issue.spec.js
deleted file mode 100644
index d8ce9edcf4f..00000000000
--- a/server/sonar-web/test/unit/issue.spec.js
+++ /dev/null
@@ -1,179 +0,0 @@
-define(function (require) {
- var bdd = require('intern!bdd');
- var assert = require('intern/chai!assert');
-
- require('intern/order!build/js/libs/translate.js');
- require('intern/order!build/js/libs/third-party/jquery.js');
- require('intern/order!build/js/libs/third-party/underscore.js');
- require('intern/order!build/js/libs/third-party/backbone.js');
- require('intern/order!build/js/libs/third-party/keymaster.js');
- require('intern/order!build/js/libs/third-party/numeral.js');
- require('intern/order!build/js/libs/third-party/numeral-languages.js');
- require('intern/order!build/js/libs/application.js');
- require('intern/order!node_modules/sinon/pkg/sinon');
-
- var Issue = require('build/js/components/issue/models/issue');
-
- bdd.describe('Issue', function () {
- bdd.before(function () {
- window.baseUrl = '';
- });
-
- bdd.it('should have correct urlRoot', function () {
- var issue = new Issue();
- assert.equal(issue.urlRoot(), '/api/issues');
- });
-
- bdd.it('should parse response without root issue object', function () {
- var issue = new Issue();
- var example = { a: 1 };
- assert.deepEqual(issue.parse(example), example);
- });
-
- bdd.it('should parse response with the root issue object', function () {
- var issue = new Issue();
- var example = { a: 1 };
- assert.deepEqual(issue.parse({ issue: example }), example);
- });
-
- bdd.it('should reset attributes (no attributes initially)', function () {
- var issue = new Issue();
- var example = { a: 1 };
- issue.reset(example);
- assert.deepEqual(issue.toJSON(), example);
- });
-
- bdd.it('should reset attributes (override attribute)', function () {
- var issue = new Issue({ a: 2 });
- var example = { a: 1 };
- issue.reset(example);
- assert.deepEqual(issue.toJSON(), example);
- });
-
- bdd.it('should reset attributes (different attributes)', function () {
- var issue = new Issue({ a: 2 });
- var example = { b: 1 };
- issue.reset(example);
- assert.deepEqual(issue.toJSON(), example);
- });
-
- bdd.it('should unset `textRange` of a closed issue', function () {
- var issue = new Issue();
- var result = issue.parse({ issue: { status: 'CLOSED', textRange: { startLine: 5 } } });
- assert.notOk(result.textRange);
- });
-
- bdd.it('should unset `flows` of a closed issue', function () {
- var issue = new Issue();
- var result = issue.parse({ issue: { status: 'CLOSED', flows: [1, 2, 3] } });
- assert.deepEqual(result.flows, []);
- });
-
- bdd.describe('Actions', function () {
- var stub;
-
- bdd.beforeEach(function () {
- stub = sinon.stub(jQuery, 'ajax');
- });
-
- bdd.afterEach(function () {
- jQuery.ajax.restore();
- });
-
- bdd.it('should assign', function () {
- new Issue({ key: 'issue-key' }).assign('admin');
- assert.isTrue(stub.calledOnce);
- assert.equal(stub.firstCall.args[0].url, '/api/issues/assign');
- assert.deepEqual(stub.firstCall.args[0].data, { issue: 'issue-key', assignee: 'admin' });
- });
-
- bdd.it('should unassign', function () {
- new Issue({ key: 'issue-key' }).assign();
- assert.isTrue(stub.calledOnce);
- assert.equal(stub.firstCall.args[0].url, '/api/issues/assign');
- assert.deepEqual(stub.firstCall.args[0].data, { issue: 'issue-key', assignee: undefined });
- });
-
- bdd.it('should plan', function () {
- new Issue({ key: 'issue-key' }).plan('plan');
- assert.isTrue(stub.calledOnce);
- assert.equal(stub.firstCall.args[0].url, '/api/issues/plan');
- assert.deepEqual(stub.firstCall.args[0].data, { issue: 'issue-key', plan: 'plan' });
- });
-
- bdd.it('should unplan', function () {
- new Issue({ key: 'issue-key' }).plan();
- assert.isTrue(stub.calledOnce);
- assert.equal(stub.firstCall.args[0].url, '/api/issues/plan');
- assert.deepEqual(stub.firstCall.args[0].data, { issue: 'issue-key', plan: undefined });
- });
-
- bdd.it('should set severity', function () {
- new Issue({ key: 'issue-key' }).setSeverity('BLOCKER');
- assert.isTrue(stub.calledOnce);
- assert.equal(stub.firstCall.args[0].url, '/api/issues/set_severity');
- assert.deepEqual(stub.firstCall.args[0].data, { issue: 'issue-key', severity: 'BLOCKER' });
- });
- });
-
- bdd.describe('#getLinearLocations', function () {
- bdd.it('should return single line location', function () {
- var issue = new Issue({ textRange: { startLine: 1, endLine: 1, startOffset: 0, endOffset: 10 } }),
- locations = issue.getLinearLocations();
- assert.equal(locations.length, 1);
-
- assert.equal(locations[0].line, 1);
- assert.equal(locations[0].from, 0);
- assert.equal(locations[0].to, 10);
- });
-
- bdd.it('should return location not from 0', function () {
- var issue = new Issue({ textRange: { startLine: 1, endLine: 1, startOffset: 5, endOffset: 10 } }),
- locations = issue.getLinearLocations();
- assert.equal(locations.length, 1);
-
- assert.equal(locations[0].line, 1);
- assert.equal(locations[0].from, 5);
- assert.equal(locations[0].to, 10);
- });
-
- bdd.it('should return 2-lines location', function () {
- var issue = new Issue({ textRange: { startLine: 2, endLine: 3, startOffset: 5, endOffset: 10 } }),
- locations = issue.getLinearLocations();
- assert.equal(locations.length, 2);
-
- assert.equal(locations[0].line, 2);
- assert.equal(locations[0].from, 5);
- assert.equal(locations[0].to, 999999);
-
- assert.equal(locations[1].line, 3);
- assert.equal(locations[1].from, 0);
- assert.equal(locations[1].to, 10);
- });
-
- bdd.it('should return 3-lines location', function () {
- var issue = new Issue({ textRange: { startLine: 4, endLine: 6, startOffset: 5, endOffset: 10 } }),
- locations = issue.getLinearLocations();
- assert.equal(locations.length, 3);
-
- assert.equal(locations[0].line, 4);
- assert.equal(locations[0].from, 5);
- assert.equal(locations[0].to, 999999);
-
- assert.equal(locations[1].line, 5);
- assert.equal(locations[1].from, 0);
- assert.equal(locations[1].to, 999999);
-
- assert.equal(locations[2].line, 6);
- assert.equal(locations[2].from, 0);
- assert.equal(locations[2].to, 10);
- });
-
- bdd.it('should return [] when no location', function () {
- var issue = new Issue(),
- locations = issue.getLinearLocations();
- assert.equal(locations.length, 0);
- });
- });
- });
-});
diff --git a/server/sonar-web/test/unit/nav/component/component-nav-breadcrumbs.spec.js b/server/sonar-web/test/unit/nav/component/component-nav-breadcrumbs.spec.js
deleted file mode 100644
index 4b2a5fecaee..00000000000
--- a/server/sonar-web/test/unit/nav/component/component-nav-breadcrumbs.spec.js
+++ /dev/null
@@ -1,27 +0,0 @@
-define(function (require) {
- var bdd = require('intern!bdd');
- var assert = require('intern/chai!assert');
-
- var React = require('react');
- var TestUtils = React.addons.TestUtils;
-
- var ComponentNavBreadcrumbs = require('build/js/apps/nav/component/component-nav-breadcrumbs');
-
- bdd.describe('ComponentNavBreadcrumbs', function () {
- bdd.it('should not render unless `props.breadcrumbs`', function () {
- var result = React.renderToStaticMarkup(React.createElement(ComponentNavBreadcrumbs, null));
- assert.equal(result, '<noscript></noscript>');
- });
-
- bdd.it('should not render breadcrumbs with one element', function () {
- var breadcrumbs = [
- { key: 'my-project', name: 'My Project', qualifier: 'TRK' }
- ];
- var result = TestUtils.renderIntoDocument(
- React.createElement(ComponentNavBreadcrumbs, { breadcrumbs: breadcrumbs })
- );
- assert.equal(TestUtils.scryRenderedDOMComponentsWithTag(result, 'li').length, 1);
- assert.equal(TestUtils.scryRenderedDOMComponentsWithTag(result, 'a').length, 1);
- });
- });
-});