1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-08 06:55:28 +02:00

Clean up tests before starting to add new once

This commit is contained in:
zinyando 2016-05-12 16:41:09 +02:00
parent 8624d21e53
commit 08fad01c6f
18 changed files with 19 additions and 272 deletions

View file

@ -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');
});
});

View file

@ -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');
});
});

View file

@ -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
});
});

View file

@ -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');
});

View file

@ -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');
});

View file

@ -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");
});

View file

@ -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");
});

View file

@ -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");
});

View file

@ -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");
});

View file

@ -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);
});

View file

@ -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);
});

View file

@ -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);
});

View file

@ -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);
});

View file

@ -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);
});

View file

@ -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);
});

View file

@ -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");
});

View file

@ -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==");
});

View file

@ -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");
});