Skip to content

A platform for community discussion. Free, open, simple.

dashboard next: adds basic spec

Joffrey JAFFEUXa9c3437d515c
diff --git a/test/javascripts/acceptance/dashboard-next-test.js.es6 b/test/javascripts/acceptance/dashboard-next-test.js.es6
new file mode 100644
index 00000000000..df119a0563a
--- /dev/null
+++ b/test/javascripts/acceptance/dashboard-next-test.js.es6
@@ -0,0 +1,16 @@
+import {
+ acceptance
+}
+from "helpers/qunit-helpers";
+
+acceptance("Dashboard Next", {
+ loggedIn: true
+});
+
+QUnit.test("Vist dashboard next page", assert => {
+ visit("/admin/dashboard-next");
+
+ andThen(() => {
+ assert.ok($('.dashboard-next').length, "has dashboard-next class");
+ });
+});
diff --git a/test/javascripts/fixtures/dashboard-next.js.es6 b/test/javascripts/fixtures/dashboard-next.js.es6
new file mode 100644
index 00000000000..4d5a8967064
--- /dev/null
+++ b/test/javascripts/fixtures/dashboard-next.js.es6
@@ -0,0 +1,146 @@
+export default {
+ "/admin/dashboard-next.json": {
+ "global_reports": [{
+ "type": "signups",
+ "title": "New Users",
+ "xaxis": "Day",
+ "yaxis": "Number of new users",
+ "data": [{
+ "x": "2018-04-11",
+ "y": 10
+ }, {
+ "x": "2018-04-12",
+ "y": 10
+ }, {
+ "x": "2018-04-13",
+ "y": 58
+ }, {
+ "x": "2018-04-15",
+ "y": 10
+ }, {
+ "x": "2018-04-16",
+ "y": 10
+ }, {
+ "x": "2018-04-17",
+ "y": 19
+ }, {
+ "x": "2018-04-19",
+ "y": 19
+ }],
+ "total": 136,
+ "start_date": "2018-03-26T00:00:00.000Z",
+ "end_date": "2018-04-25T23:59:59.999Z",
+ "category_id": null,
+ "group_id": null,
+ "prev30Days": 0,
+ "labels": null
+ }, {
+ "type": "topics",
+ "title": "Topics",
+ "xaxis": "Day",
+ "yaxis": "Number of new topics",
+ "data": [{
+ "x": "2018-04-11",
+ "y": 10
+ }, {
+ "x": "2018-04-12",
+ "y": 10
+ }, {
+ "x": "2018-04-13",
+ "y": 60
+ }, {
+ "x": "2018-04-15",
+ "y": 10
+ }, {
+ "x": "2018-04-16",
+ "y": 10
+ }, {
+ "x": "2018-04-17",
+ "y": 10
+ }, {
+ "x": "2018-04-19",
+ "y": 10
+ }, {
+ "x": "2018-04-20",
+ "y": 1
+ }],
+ "total": 121,
+ "start_date": "2018-03-26T00:00:00.000Z",
+ "end_date": "2018-04-25T23:59:59.999Z",
+ "category_id": null,
+ "group_id": null,
+ "prev30Days": 0,
+ "labels": null
+ }, {
+ "type": "trending_search",
+ "title": "Trending search",
+ "xaxis": "translation missing: en.reports.trending_search.xaxis",
+ "yaxis": "translation missing: en.reports.trending_search.yaxis",
+ "data": [
+ ["lon", 3, 1],
+ ["pub", 1, 1],
+ ["something", 1, 1]
+ ],
+ "total": null,
+ "start_date": "2018-03-26T00:00:00.000Z",
+ "end_date": "2018-04-25T23:59:59.999Z",
+ "category_id": null,
+ "group_id": null,
+ "prev30Days": null,
+ "labels": ["Term", "Searches", "Unique"]
+ }],
+ "user_reports": [{
+ "type": "users_by_trust_level",
+ "title": "Users per Trust Level",
+ "xaxis": "Trust Level",
+ "yaxis": "Number of Users",
+ "data": [{
+ "x": 0,
+ "y": 132
+ }, {
+ "x": 1,
+ "y": 1
+ }, {
+ "x": 3,
+ "y": 1
+ }, {
+ "x": 2,
+ "y": 1
+ }, {
+ "x": 4,
+ "y": 1
+ }],
+ "total": null,
+ "start_date": "2018-03-26T00:00:00.000Z",
+ "end_date": "2018-04-25T23:59:59.999Z",
+ "category_id": null,
+ "group_id": null,
+ "prev30Days": null,
+ "labels": null
+ }, {
+ "type": "users_by_type",
+ "title": "Users per Type",
+ "xaxis": "Type",
+ "yaxis": "Number of Users",
+ "data": [{
+ "x": "Admin",
+ "y": 1
+ }],
+ "total": null,
+ "start_date": "2018-03-26T00:00:00.000Z",
+ "end_date": "2018-04-25T23:59:59.999Z",
+ "category_id": null,
+ "group_id": null,
+ "prev30Days": null,
+ "labels": null
+ }],
+ "last_backup_taken_at": "2018-04-13T12:51:19.926Z",
+ "updated_at": "2018-04-25T08:06:11.292Z",
+ "disk_space": {
+ "uploads_used": "74.5 KB",
+ "uploads_free": "117 GB",
+ "backups_used": "4.24 GB",
+ "backups_free": "117 GB"
+ }
+ }
+};
diff --git a/test/javascripts/fixtures/signups.js.es6 b/test/javascripts/fixtures/signups.js.es6
new file mode 100644
index 00000000000..a93d26fe06c
--- /dev/null
+++ b/test/javascripts/fixtures/signups.js.es6
@@ -0,0 +1,45 @@
+export default {
+ "/admin/reports/signups": {
+ "report": {
+ "type": "signups",
+ "title": "New Users",
+ "xaxis": "Day",
+ "yaxis": "Number of new users",
+ "data": [{
+ "x": "2018-04-11",
+ "y": 10
+ }, {
+ "x": "2018-04-12",
+ "y": 10
+ }, {
+ "x": "2018-04-13",
+ "y": 22
+ }, {
+ "x": "2018-04-14",
+ "y": 58
+ }, {
+ "x": "2018-04-15",
+ "y": 10
+ }, {
+ "x": "2018-04-16",
+ "y": 10
+ }, {
+ "x": "2018-04-17",
+ "y": 19
+ }, {
+ "x": "2018-04-18",
+ "y": 12
+ }, {
+ "x": "2018-04-19",
+ "y": 19
+ }],
+ "total": 136,
+ "start_date": "2018-03-26T00:00:00.000Z",
+ "end_date": "2018-04-25T23:59:59.999Z",
+ "category_id": null,
+ "group_id": null,
+ "prev30Days": 0,
+ "labels": null
+ }
+ }
+};
diff --git a/test/javascripts/fixtures/topics.js.es6 b/test/javascripts/fixtures/topics.js.es6
new file mode 100644
index 00000000000..7291642b5c2
--- /dev/null
+++ b/test/javascripts/fixtures/topics.js.es6
@@ -0,0 +1,48 @@
+export default {
+ "/admin/reports/topics": {
+ "report": {
+ "type": "topics",
+ "title": "Topics",
+ "xaxis": "Day",
+ "yaxis": "Number of new topics",
+ "data": [{
+ "x": "2018-04-11",
+ "y": 10
+ }, {
+ "x": "2018-04-12",
+ "y": 10
+ }, {
+ "x": "2018-04-13",
+ "y": 60
+ }, {
+ "x": "2018-04-14",
+ "y": 60
+ }, {
+ "x": "2018-04-15",
+ "y": 10
+ }, {
+ "x": "2018-04-16",
+ "y": 10
+ }, {
+ "x": "2018-04-17",
+ "y": 10
+ }, {
+ "x": "2018-04-19",
+ "y": 10
+ }, {
+ "x": "2018-04-18",
+ "y": 10
+ }, {
+ "x": "2018-04-20",
+ "y": 1
+ }],
+ "total": 121,
+ "start_date": "2018-03-26T00:00:00.000Z",
+ "end_date": "2018-04-25T23:59:59.999Z",
+ "category_id": null,
+ "group_id": null,
+ "prev30Days": 0,
+ "labels": null
+ }
+ }
+};
diff --git a/test/javascripts/fixtures/trending-search.js.es6 b/test/javascripts/fixtures/trending-search.js.es6
new file mode 100644
index 00000000000..11a6070aa80
--- /dev/null
+++ b/test/javascripts/fixtures/trending-search.js.es6
@@ -0,0 +1,22 @@
+export default {
+ "/admin/reports/trending_search": {
+ "report": {
+ "type": "trending_search",
+ "title": "Trending search",
+ "xaxis": "",
+ "yaxis": "",
+ "data": [
+ ["lon", 3, 1],
+ ["pub", 1, 1],
+ ["something", 1, 1]
+ ],
+ "total": null,
+ "start_date": "2018-03-26T00:00:00.000Z",
+ "end_date": "2018-04-25T23:59:59.999Z",
+ "category_id": null,
+ "group_id": null,
+ "prev30Days": null,
+ "labels": ["Term", "Searches", "Unique"]
+ }
+ }
+};