From 08fad01c6fed19dd8536beb153704bedbd023d2f Mon Sep 17 00:00:00 2001 From: zinyando Date: Thu, 12 May 2016 16:41:09 +0200 Subject: [PATCH] Clean up tests before starting to add new once --- app/tests/acceptance/index-test.js | 19 ++++++++++ app/tests/acceptance/login-test.js | 35 ------------------- app/tests/acceptance/nologin-test.js | 12 ------- .../section/gemini/type-editor-test.js | 24 ------------- .../section/gemini/type-renderer-test.js | 24 ------------- .../unit/helpers/document/file-icon-test.js | 14 -------- app/tests/unit/helpers/formatted-date-test.js | 9 ----- app/tests/unit/helpers/time-ago-test.js | 9 ----- app/tests/unit/helpers/user-initials-test.js | 9 ----- app/tests/unit/initializers/audit-test.js | 22 ------------ app/tests/unit/mixins/notifier-test.js | 12 ------- app/tests/unit/mixins/tooltip-test.js | 12 ------- .../unit/pods/document/wizard/route-test.js | 11 ------ app/tests/unit/routes/document/wizard-test.js | 11 ------ app/tests/unit/services/section-test.js | 12 ------- app/tests/unit/utils/date-test.js | 33 ----------------- app/tests/unit/utils/encoding-test.js | 9 ----- app/tests/unit/utils/string-test.js | 14 -------- 18 files changed, 19 insertions(+), 272 deletions(-) create mode 100644 app/tests/acceptance/index-test.js delete mode 100644 app/tests/acceptance/login-test.js delete mode 100644 app/tests/acceptance/nologin-test.js delete mode 100644 app/tests/integration/components/section/gemini/type-editor-test.js delete mode 100644 app/tests/integration/components/section/gemini/type-renderer-test.js delete mode 100644 app/tests/unit/helpers/document/file-icon-test.js delete mode 100644 app/tests/unit/helpers/formatted-date-test.js delete mode 100644 app/tests/unit/helpers/time-ago-test.js delete mode 100644 app/tests/unit/helpers/user-initials-test.js delete mode 100644 app/tests/unit/initializers/audit-test.js delete mode 100644 app/tests/unit/mixins/notifier-test.js delete mode 100644 app/tests/unit/mixins/tooltip-test.js delete mode 100644 app/tests/unit/pods/document/wizard/route-test.js delete mode 100644 app/tests/unit/routes/document/wizard-test.js delete mode 100644 app/tests/unit/services/section-test.js delete mode 100644 app/tests/unit/utils/date-test.js delete mode 100644 app/tests/unit/utils/encoding-test.js delete mode 100644 app/tests/unit/utils/string-test.js diff --git a/app/tests/acceptance/index-test.js b/app/tests/acceptance/index-test.js new file mode 100644 index 00000000..b91d1d0a --- /dev/null +++ b/app/tests/acceptance/index-test.js @@ -0,0 +1,19 @@ +import { test } from 'qunit'; +import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance'; + +moduleForAcceptance('Acceptance | /'); + +// TODO: when accessing / with /api/public/meta -> { allowAnonymousAccess: false } then take user to login +// TODO: when accessing / with /api/public/meta -> { allowAnonymousAccess: true } then take user to folers.index +// TODO: when accessing / with /api/public/meta -> { allowAnonymousAccess: true } and user is authenticated -> show authenticated user information + +test('visiting /', function(assert) { + visit('/'); + + // setup mirage for /api/public/meta -> { allowAnonymousAccess: false} + + + andThen(function() { + assert.equal(currentURL(), '/login'); + }); +}); diff --git a/app/tests/acceptance/login-test.js b/app/tests/acceptance/login-test.js deleted file mode 100644 index 9ecbe69e..00000000 --- a/app/tests/acceptance/login-test.js +++ /dev/null @@ -1,35 +0,0 @@ -import Ember from 'ember'; -import { - module, - test -} from 'qunit'; -import startApp from 'ember-testing/tests/helpers/start-app'; -import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance'; - -moduleForAcceptance('Acceptance | login'); - -var application; - -module('Acceptance | login', { - beforeEach: function() { - application = startApp(); - window.localStorage.removeItem('token'); - window.localStorage.removeItem('user'); - window.localStorage.removeItem('folder'); - }, - - afterEach: function() { - Ember.run(application, 'destroy'); - } -}); - - -test('visiting /auth/login', function(assert) { - visit('/auth/login'); - // fillIn('#authEmail', 'harvey@kandola.com'); - // fillIn('#authPassword', 'demo123'); - // click('button'); - andThen(function() { - assert.equal(currentURL(), '/auth/login'); - }); -}); \ No newline at end of file diff --git a/app/tests/acceptance/nologin-test.js b/app/tests/acceptance/nologin-test.js deleted file mode 100644 index 5db6fd84..00000000 --- a/app/tests/acceptance/nologin-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { test } from 'qunit'; -import moduleForAcceptance from 'documize/tests/helpers/module-for-acceptance'; - -moduleForAcceptance('Acceptance | nologin'); - -test('visiting /', function(assert) { - visit('/'); - - andThen(function() { - assert.equal(currentURL().substring(0, 3), '/s/'); // NOTE because we do not know the correct uuid/space for the database being tested - }); -}); diff --git a/app/tests/integration/components/section/gemini/type-editor-test.js b/app/tests/integration/components/section/gemini/type-editor-test.js deleted file mode 100644 index 10f5704c..00000000 --- a/app/tests/integration/components/section/gemini/type-editor-test.js +++ /dev/null @@ -1,24 +0,0 @@ -import { moduleForComponent, test } from 'ember-qunit'; -import hbs from 'htmlbars-inline-precompile'; - -moduleForComponent('section/gemini/type-editor', 'Integration | Component | section/gemini/type editor', { - integration: true -}); - -test('it renders', function(assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.on('myAction', function(val) { ... }); - - this.render(hbs`{{section/gemini/type-editor}}`); - - assert.equal(this.$().text().trim(), ''); - - // Template block usage: - this.render(hbs` - {{#section/gemini/type-editor}} - template block text - {{/section/gemini/type-editor}} - `); - - assert.equal(this.$().text().trim(), 'template block text'); -}); diff --git a/app/tests/integration/components/section/gemini/type-renderer-test.js b/app/tests/integration/components/section/gemini/type-renderer-test.js deleted file mode 100644 index 3655012f..00000000 --- a/app/tests/integration/components/section/gemini/type-renderer-test.js +++ /dev/null @@ -1,24 +0,0 @@ -import { moduleForComponent, test } from 'ember-qunit'; -import hbs from 'htmlbars-inline-precompile'; - -moduleForComponent('section/gemini/type-renderer', 'Integration | Component | section/gemini/type renderer', { - integration: true -}); - -test('it renders', function(assert) { - // Set any properties with this.set('myProperty', 'value'); - // Handle any actions with this.on('myAction', function(val) { ... }); - - this.render(hbs`{{section/gemini/type-renderer}}`); - - assert.equal(this.$().text().trim(), ''); - - // Template block usage: - this.render(hbs` - {{#section/gemini/type-renderer}} - template block text - {{/section/gemini/type-renderer}} - `); - - assert.equal(this.$().text().trim(), 'template block text'); -}); diff --git a/app/tests/unit/helpers/document/file-icon-test.js b/app/tests/unit/helpers/document/file-icon-test.js deleted file mode 100644 index 89dca6ac..00000000 --- a/app/tests/unit/helpers/document/file-icon-test.js +++ /dev/null @@ -1,14 +0,0 @@ -import { documentFileIcon } from '../../../../helpers/document/file-icon'; -import { module, test } from 'qunit'; - -module('Unit | Helper | document/file icon'); - -test('should be file icon of ZIP', function(assert) { - let result = documentFileIcon(["zIp"]); - assert.equal(result, "zip.png"); -}); - -test('should be file icon of ZIP (tar)', function(assert) { - let result = documentFileIcon(["TAR"]); - assert.equal(result, "zip.png"); -}); diff --git a/app/tests/unit/helpers/formatted-date-test.js b/app/tests/unit/helpers/formatted-date-test.js deleted file mode 100644 index 3e77b535..00000000 --- a/app/tests/unit/helpers/formatted-date-test.js +++ /dev/null @@ -1,9 +0,0 @@ -import { formattedDate } from '../../../helpers/formatted-date'; -import { module, test } from 'qunit'; - -module('Unit | Helper | formatted date'); - -test('should format date', function(assert) { - let result = formattedDate([new Date("1995-12-17T20:18:00"), "Do MMMM YYYY, HH:mm"]); - assert.equal(result, "17th December 1995, 20:18"); -}); diff --git a/app/tests/unit/helpers/time-ago-test.js b/app/tests/unit/helpers/time-ago-test.js deleted file mode 100644 index 82a99e84..00000000 --- a/app/tests/unit/helpers/time-ago-test.js +++ /dev/null @@ -1,9 +0,0 @@ -import { timeAgo } from '../../../helpers/time-ago'; -import { module, test } from 'qunit'; - -module('Unit | Helper | time ago'); - -test('should format date as time ago', function(assert) { - let result = timeAgo([new Date()]); - assert.equal(result, "a few seconds ago"); -}); diff --git a/app/tests/unit/helpers/user-initials-test.js b/app/tests/unit/helpers/user-initials-test.js deleted file mode 100644 index a64893f9..00000000 --- a/app/tests/unit/helpers/user-initials-test.js +++ /dev/null @@ -1,9 +0,0 @@ -import { userInitials } from '../../../helpers/user-initials'; -import { module, test } from 'qunit'; - -module('Unit | Helper | user initials'); - -test('should uppercase initials from firstname lastname', function(assert) { - let result = userInitials(["Some", "name"]); - assert.equal(result, "SN"); -}); diff --git a/app/tests/unit/initializers/audit-test.js b/app/tests/unit/initializers/audit-test.js deleted file mode 100644 index 7f80c3b1..00000000 --- a/app/tests/unit/initializers/audit-test.js +++ /dev/null @@ -1,22 +0,0 @@ -import Ember from 'ember'; -import AuditInitializer from '../../../initializers/audit'; -import { module, test } from 'qunit'; - -let application; - -module('Unit | Initializer | audit', { - beforeEach() { - Ember.run(function() { - application = Ember.Application.create(); - application.deferReadiness(); - }); - } -}); - -// Replace this with your real tests. -test('it works', function(assert) { - AuditInitializer.initialize(application); - - // you would normally confirm the results of the initializer here - assert.ok(true); -}); diff --git a/app/tests/unit/mixins/notifier-test.js b/app/tests/unit/mixins/notifier-test.js deleted file mode 100644 index 1885603b..00000000 --- a/app/tests/unit/mixins/notifier-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import Ember from 'ember'; -import NotifierMixin from '../../../mixins/notifier'; -import { module, test } from 'qunit'; - -module('Unit | Mixin | notifier'); - -// Replace this with your real tests. -test('it works', function(assert) { - let NotifierObject = Ember.Object.extend(NotifierMixin); - let subject = NotifierObject.create(); - assert.ok(subject); -}); diff --git a/app/tests/unit/mixins/tooltip-test.js b/app/tests/unit/mixins/tooltip-test.js deleted file mode 100644 index 31bdac82..00000000 --- a/app/tests/unit/mixins/tooltip-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import Ember from 'ember'; -import TooltipMixin from '../../../mixins/tooltip'; -import { module, test } from 'qunit'; - -module('Unit | Mixin | tooltip'); - -// Replace this with your real tests. -test('it works', function(assert) { - let TooltipObject = Ember.Object.extend(TooltipMixin); - let subject = TooltipObject.create(); - assert.ok(subject); -}); diff --git a/app/tests/unit/pods/document/wizard/route-test.js b/app/tests/unit/pods/document/wizard/route-test.js deleted file mode 100644 index a05271f5..00000000 --- a/app/tests/unit/pods/document/wizard/route-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { moduleFor, test } from 'ember-qunit'; - -moduleFor('route:document/wizard', 'Unit | Route | document/wizard', { - // Specify the other units that are required for this test. - // needs: ['controller:foo'] -}); - -test('it exists', function(assert) { - let route = this.subject(); - assert.ok(route); -}); diff --git a/app/tests/unit/routes/document/wizard-test.js b/app/tests/unit/routes/document/wizard-test.js deleted file mode 100644 index a05271f5..00000000 --- a/app/tests/unit/routes/document/wizard-test.js +++ /dev/null @@ -1,11 +0,0 @@ -import { moduleFor, test } from 'ember-qunit'; - -moduleFor('route:document/wizard', 'Unit | Route | document/wizard', { - // Specify the other units that are required for this test. - // needs: ['controller:foo'] -}); - -test('it exists', function(assert) { - let route = this.subject(); - assert.ok(route); -}); diff --git a/app/tests/unit/services/section-test.js b/app/tests/unit/services/section-test.js deleted file mode 100644 index 6b77e35d..00000000 --- a/app/tests/unit/services/section-test.js +++ /dev/null @@ -1,12 +0,0 @@ -import { moduleFor, test } from 'ember-qunit'; - -moduleFor('service:section', 'Unit | Service | section', { - // Specify the other units that are required for this test. - // needs: ['service:foo'] -}); - -// Replace this with your real tests. -test('it exists', function(assert) { - let service = this.subject(); - assert.ok(service); -}); diff --git a/app/tests/unit/utils/date-test.js b/app/tests/unit/utils/date-test.js deleted file mode 100644 index a13ad94c..00000000 --- a/app/tests/unit/utils/date-test.js +++ /dev/null @@ -1,33 +0,0 @@ -import dateUtil from '../../../utils/date'; -import { module, test } from 'qunit'; - -module('Unit | Utility | date helpers'); - -test("should calculate time ago of a few seconds", function(assert) { - let result = dateUtil.timeAgo(new Date()); - assert.equal(result, "a few seconds ago"); -}); - -test("should calculate time ago of a day", function(assert) { - var temp = new Date(); - temp.setDate(temp.getDate()-1); - let result = dateUtil.timeAgo(temp); - assert.equal(result, "a day ago"); -}); - -test("should calculate time ago of 2 days", function(assert) { - var temp = new Date(); - temp.setDate(temp.getDate()-2); - let result = dateUtil.timeAgo(temp); - assert.equal(result, "2 days ago"); -}); - -test("should handle ISO date", function(assert) { - let result = dateUtil.toIsoDate(new Date("1995, 12, 17")); - assert.equal(result, "1995-12-17T00:00:00+00:00"); -}); - -test("should format short date", function(assert) { - let result = dateUtil.toShortDate(new Date("1995, 12, 17")); - assert.equal(result, "1995/12/17"); -}); diff --git a/app/tests/unit/utils/encoding-test.js b/app/tests/unit/utils/encoding-test.js deleted file mode 100644 index aaf2cc08..00000000 --- a/app/tests/unit/utils/encoding-test.js +++ /dev/null @@ -1,9 +0,0 @@ -import encodingUtil from '../../../utils/encoding'; -import { module, test } from 'qunit'; - -module('Unit | Utility | encoding helpers'); - -test("should correctly Base64 encode", function(assert) { - let result = encodingUtil.Base64.encode("test"); - assert.equal(result, "dGVzdA=="); -}); diff --git a/app/tests/unit/utils/string-test.js b/app/tests/unit/utils/string-test.js deleted file mode 100644 index f90c3864..00000000 --- a/app/tests/unit/utils/string-test.js +++ /dev/null @@ -1,14 +0,0 @@ -import stringUtil from '../../../utils/string'; -import { module, test } from 'qunit'; - -module('Unit | Utility | string'); - -test("should find string suffix", function(assert) { - let result = stringUtil.endsWith("some words", "words"); - assert.ok(result); -}); - -test("should generate slug", function(assert) { - let result = stringUtil.makeSlug("something to slug"); - assert.equal(result, "something-to-slug"); -});