fix: 🐛 test cases

This commit is contained in:
dharini committed 2021-08-16 17:10:18 -07:00
1 parent ee390a6fea
commit c2ffe19d44
4 files changed
+21 -2

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"compilerOptions":{"target":"es6","experimentalDecorators":true},"exclude":["node_modules","bower_components","tmp","vendor",".git","dist"]}
@@ -24,6 +24,7 @@ module('Acceptance | users', function (hooks) {
},
user: null,
};
hooks.beforeEach(function () {
orgScope = this.server.create(
'scope',
+18 -2
View File
@@ -18,6 +18,14 @@ module('Acceptance | users', function (hooks) {
let usersURL;
let userURL;
const instances = {
scopes: {
global: null,
org: null,
},
user: null,
};
hooks.beforeEach(function () {
orgScope = this.server.create(
'scope',
@@ -27,12 +35,12 @@ module('Acceptance | users', function (hooks) {
'withChildren'
);
const user = this.server.create('user', {
instances.user = this.server.create('user', {
scope: orgScope,
});
usersURL = `/scopes/${orgScope.id}/users`;
userURL = `${usersURL}/${user.id}`;
userURL = `${usersURL}/${instances.user.id}`;
authenticateSession({});
});
@@ -55,6 +63,14 @@ module('Acceptance | users', function (hooks) {
assert.notEqual(find('[name="name"]').value, 'Unsaved user name');
});
test('cannot make changes to an existing user without proper authorization', async function (assert) {
assert.expect(1);
instances.user.authorized_actions =
instances.user.authorized_actions.filter((item) => item !== 'update');
await visit(userURL);
assert.notOk(find('.rose-layout-page-actions .rose-button-secondary'));
});
test('saving an existing user with invalid fields displays error messages', async function (assert) {
assert.expect(2);
this.server.patch('/users/:id', () => {
+1
View File
@@ -0,0 +1 @@
{"compilerOptions":{"target":"es6","experimentalDecorators":true},"exclude":["node_modules","bower_components","tmp","vendor",".git","dist"]}