aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/tests/helpers/urls-test.js
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-05-19 18:26:36 +0200
committerStas Vilchik <vilchiks@gmail.com>2016-06-03 16:09:08 +0200
commit364cd42b9bb92eb42f0adce613185e0bb8771672 (patch)
tree4161fb41affa5ff3c6871959e302192e615116a9 /server/sonar-web/tests/helpers/urls-test.js
parent2ecead20c72c9348966fb7605e81df637b429e83 (diff)
downloadsonarqube-364cd42b9bb92eb42f0adce613185e0bb8771672.tar.gz
sonarqube-364cd42b9bb92eb42f0adce613185e0bb8771672.zip
move tests
Diffstat (limited to 'server/sonar-web/tests/helpers/urls-test.js')
-rw-r--r--server/sonar-web/tests/helpers/urls-test.js84
1 files changed, 0 insertions, 84 deletions
diff --git a/server/sonar-web/tests/helpers/urls-test.js b/server/sonar-web/tests/helpers/urls-test.js
deleted file mode 100644
index 39b7c43b963..00000000000
--- a/server/sonar-web/tests/helpers/urls-test.js
+++ /dev/null
@@ -1,84 +0,0 @@
-import { expect } from 'chai';
-
-import { getComponentUrl, getComponentIssuesUrl, getComponentDrilldownUrl } from '../../src/main/js/helpers/urls';
-
-
-const SIMPLE_COMPONENT_KEY = 'sonarqube';
-const COMPLEX_COMPONENT_KEY = 'org.sonarsource.sonarqube:sonarqube';
-const COMPLEX_COMPONENT_KEY_ENCODED = encodeURIComponent(COMPLEX_COMPONENT_KEY);
-const METRIC = 'coverage';
-const PERIOD = '3';
-
-
-describe('URLs', function () {
- var oldBaseUrl;
-
- beforeEach(function () {
- oldBaseUrl = window.baseUrl;
- });
-
- afterEach(function () {
- window.baseUrl = oldBaseUrl;
- });
-
- describe('#getComponentUrl', function () {
- it('should return component url', function () {
- expect(getComponentUrl(SIMPLE_COMPONENT_KEY)).to.equal('/dashboard?id=' + SIMPLE_COMPONENT_KEY);
- });
-
- it('should encode component key', function () {
- expect(getComponentUrl(COMPLEX_COMPONENT_KEY)).to.equal('/dashboard?id=' + COMPLEX_COMPONENT_KEY_ENCODED);
- });
-
- it('should take baseUrl into account', function () {
- window.baseUrl = '/context';
- expect(getComponentUrl(COMPLEX_COMPONENT_KEY)).to.equal('/context/dashboard?id=' + COMPLEX_COMPONENT_KEY_ENCODED);
- });
- });
-
- describe('#getComponentIssuesUrl', function () {
- it('should work without parameters', function () {
- expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY, {})).to.equal(
- '/component_issues?id=' + SIMPLE_COMPONENT_KEY + '#');
- });
-
- it('should encode component key', function () {
- expect(getComponentIssuesUrl(COMPLEX_COMPONENT_KEY, {})).to.equal(
- '/component_issues?id=' + COMPLEX_COMPONENT_KEY_ENCODED + '#');
- });
-
- it('should work with parameters', function () {
- expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY, { resolved: 'false' })).to.equal(
- '/component_issues?id=' + SIMPLE_COMPONENT_KEY + '#resolved=false');
- });
-
- it('should encode parameters', function () {
- expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY, { componentUuids: COMPLEX_COMPONENT_KEY })).to.equal(
- '/component_issues?id=' + SIMPLE_COMPONENT_KEY + '#componentUuids=' + COMPLEX_COMPONENT_KEY_ENCODED);
- });
-
- it('should take baseUrl into account', function () {
- window.baseUrl = '/context';
- expect(getComponentIssuesUrl(SIMPLE_COMPONENT_KEY, {})).to.equal(
- '/context/component_issues?id=' + SIMPLE_COMPONENT_KEY + '#');
- });
- });
-
- describe('#getComponentDrilldownUrl', function () {
- it('should return component drilldown url', function () {
- expect(getComponentDrilldownUrl(SIMPLE_COMPONENT_KEY, METRIC)).to.equal(
- '/component_measures/metric/' + METRIC + '?id=' + SIMPLE_COMPONENT_KEY);
- });
-
- it('should encode component key', function () {
- expect(getComponentDrilldownUrl(COMPLEX_COMPONENT_KEY, METRIC)).to.equal(
- '/component_measures/metric/' + METRIC + '?id=' + COMPLEX_COMPONENT_KEY_ENCODED);
- });
-
- it('should take baseUrl into account', function () {
- window.baseUrl = '/context';
- expect(getComponentDrilldownUrl(SIMPLE_COMPONENT_KEY, METRIC)).to.equal(
- '/context/component_measures/metric/' + METRIC + '?id=' + SIMPLE_COMPONENT_KEY);
- });
- });
-});