Skip to content
Snippets Groups Projects
Commit 952104e4 authored by Eugen Ciur's avatar Eugen Ciur
Browse files

add couple of tests

parent 826db157
No related branches found
No related tags found
No related merge requests found
......@@ -103,4 +103,106 @@ export default function() {
}
});
this.get('/api/nodes/1/', () => {
return {
"data": [
{
"type": "folders",
"id":"4",
"attributes": {
"title": "Folder 1",
"created_at": "2021-11-24T20:54:38.833485+01:00",
"updated_at":"2021-11-24T20:54:38.833509+01:00"
},
"relationships": {
"parent": {
"data":null
}
}
},
{
"type": "folders",
"id":"5",
"attributes": {
"title": "Folder 2",
"created_at": "2021-11-24T20:54:38.833485+01:00",
"updated_at":"2021-11-24T20:54:38.833509+01:00"
},
"relationships": {
"parent": {
"data":null
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pages": 1,
"count": 2
}
},
"links": {
"first": "",
"last": "",
"next": "",
"prev": ""
}
}
});
this.get('/api/nodes/2/', () => {
return {
"data": [
{
"type": "folders",
"id":"4",
"attributes": {
"title": "Folder 1",
"created_at": "2021-11-24T20:54:38.833485+01:00",
"updated_at":"2021-11-24T20:54:38.833509+01:00"
},
"relationships": {
"parent": {
"data":null
}
}
},
{
"type": "folders",
"id":"5",
"attributes": {
"title": "Folder 2",
"created_at": "2021-11-24T20:54:38.833485+01:00",
"updated_at":"2021-11-24T20:54:38.833509+01:00"
},
"relationships": {
"parent": {
"data":null
}
}
}
],
"meta": {
"pagination": {
"page": 1,
"pages": 1,
"count": 2
}
},
"links": {
"first": "",
"last": "",
"next": "",
"prev": ""
}
}
});
this.get('/api/preferences/', () => {
return {
"data": []
}
});
}
import { module, test } from 'qunit';
import { visit, currentURL } from '@ember/test-helpers';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-support/setup-mirage';
import { authenticateSession } from 'ember-simple-auth/test-support';
module('Acceptance | authenticated', function (hooks) {
setupApplicationTest(hooks);
setupMirage(hooks);
hooks.beforeEach(async function () {
await authenticateSession({
authToken: '12345',
otherData: 'some-data'
});
});
test('visiting / will redirect user to his home folder', async function (assert) {
/*
* Make sure that authenticated.index routes redirects to user's home folder
*/
await visit('/'); // visit root url
assert.strictEqual(currentURL(), '/nodes/2'); // user is redirected to home folder
});
test('visiting /nodes/1/ will land user in his home folder', async function (assert) {
await visit('/nodes/1/');
assert.strictEqual(currentURL(), '/nodes/1/');
});
});
......@@ -20,7 +20,7 @@ module('Acceptance | roles', function (hooks) {
test('visiting /roles', async function (assert) {
await visit('/roles');
assert.equal(currentURL(), '/roles');
assert.strictEqual(currentURL(), '/roles');
assert.dom('.roles-add').hasText('New', 'The user can add new role');
});
});
......@@ -20,7 +20,7 @@ module('Acceptance | tags', function (hooks) {
test('visiting /tags', async function (assert) {
await visit('/tags');
assert.equal(currentURL(), '/tags');
assert.strictEqual(currentURL(), '/tags');
assert.dom('.add-tag').hasText('New', 'The user can add new tag');
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment