summaryrefslogtreecommitdiffstats
path: root/server/sonar-web/test
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-08-10 14:58:44 +0200
committerStas Vilchik <vilchiks@gmail.com>2015-08-10 17:11:54 +0200
commitb32088dc48ac79847aa1a28d20ab9305a10d32e1 (patch)
tree46f97aee9842aa483de89d64d064bbc6575c818a /server/sonar-web/test
parentcc871d7b8c4af1f66234830719d27e45d4136334 (diff)
downloadsonarqube-b32088dc48ac79847aa1a28d20ab9305a10d32e1.tar.gz
sonarqube-b32088dc48ac79847aa1a28d20ab9305a10d32e1.zip
SONAR-6331 add tests
Diffstat (limited to 'server/sonar-web/test')
-rw-r--r--server/sonar-web/test/intern-browser.js22
-rw-r--r--server/sonar-web/test/intern.js3
-rw-r--r--server/sonar-web/test/unit/overview/card.spec.js36
3 files changed, 38 insertions, 23 deletions
diff --git a/server/sonar-web/test/intern-browser.js b/server/sonar-web/test/intern-browser.js
deleted file mode 100644
index e0be66f5869..00000000000
--- a/server/sonar-web/test/intern-browser.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/* jshint node:true */
-define({
- excludeInstrumentation: /(test|third-party|node_modules)\//,
-
- defaultTimeout: 60 * 1000,
-
- suites: [
- 'test/unit/application.spec',
- 'test/unit/issue.spec'
- ],
-
- tunnel: 'NullTunnel',
- environments: [
- { browserName: 'firefox' }
- ],
-
- loaderOptions: {
- paths: {
- 'react': 'build/js/libs/third-party/react-with-addons'
- }
- }
-});
diff --git a/server/sonar-web/test/intern.js b/server/sonar-web/test/intern.js
index e5d3691a7f7..16b5ff93c82 100644
--- a/server/sonar-web/test/intern.js
+++ b/server/sonar-web/test/intern.js
@@ -16,7 +16,8 @@ define(['intern'], function (intern) {
suites: [
'test/unit/application.spec',
- 'test/unit/issue.spec'
+ 'test/unit/issue.spec',
+ 'test/unit/overview/card.spec'
],
functionalSuites: [
diff --git a/server/sonar-web/test/unit/overview/card.spec.js b/server/sonar-web/test/unit/overview/card.spec.js
new file mode 100644
index 00000000000..148f9144258
--- /dev/null
+++ b/server/sonar-web/test/unit/overview/card.spec.js
@@ -0,0 +1,36 @@
+define(function (require) {
+ var bdd = require('intern!bdd');
+ var assert = require('intern/chai!assert');
+
+ require('intern/order!build/js/libs/translate.js');
+
+ var React = require('react');
+ var TestUtils = React.addons.TestUtils;
+
+ var Card = require('build/js/apps/overview/card');
+ var Cards = require('build/js/apps/overview/cards');
+
+ bdd.describe('Overview - Card', function () {
+ bdd.it('should render .overview-card', function () {
+ var result = TestUtils.renderIntoDocument(React.createElement(Card, null));
+ assert.ok(TestUtils.findRenderedDOMComponentWithClass(result, 'overview-card'));
+ });
+
+ bdd.it('should render children', function () {
+ var result = TestUtils.renderIntoDocument(React.createElement(Card, null, '!'));
+ assert.equal('!', result.getDOMNode().textContent);
+ });
+ });
+
+ bdd.describe('Overview - Cards', function () {
+ bdd.it('should render .overview-cards', function () {
+ var result = TestUtils.renderIntoDocument(React.createElement(Cards, null));
+ assert.ok(TestUtils.findRenderedDOMComponentWithClass(result, 'overview-cards'));
+ });
+
+ bdd.it('should render children', function () {
+ var result = TestUtils.renderIntoDocument(React.createElement(Cards, null, '!'));
+ assert.equal('!', result.getDOMNode().textContent);
+ });
+ });
+});