mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-14 20:49:48 +00:00

* finish the alc access page layout, logics and sass files * Fix css issue and request permission response error message * finish the testing part * simplify code finished * finish spinner * Finished ACL access page, testing cases, clean code format * Clean format, address comments, refactor JS code of ACL page to TS * address comments, replace type any and fix merge issue
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import { moduleForComponent, test } from 'ember-qunit';
|
|
import Notifications from 'wherehows-web/services/notifications';
|
|
import { accessState } from 'wherehows-web/constants/dataset-aclaccess';
|
|
import { accessInfoTesting as accessInfo } from 'wherehows-web/mirage/helpers/aclauth';
|
|
|
|
moduleForComponent('dataset-aclaccess', 'Unit | Component | dataset aclaccess', {
|
|
unit: true,
|
|
needs: ['component:empty-state'],
|
|
|
|
beforeEach() {
|
|
this.register('service:notifications', Notifications);
|
|
}
|
|
});
|
|
|
|
test('should return the pageSate and users correctly', function(assert) {
|
|
const aclaccess = this.subject();
|
|
const approved = accessInfo(true);
|
|
|
|
aclaccess.set('accessInfo', approved);
|
|
|
|
assert.equal(aclaccess.get('pageState'), 'hasAccess', 'pageState without errors');
|
|
|
|
assert.ok(aclaccess.get('users'), 'users existed');
|
|
});
|
|
|
|
test('should return state correctly', function(assert) {
|
|
const aclaccess = this.subject();
|
|
|
|
aclaccess.setProperties({
|
|
pageState: 'noAccess',
|
|
currentUser: 'Abc'
|
|
});
|
|
|
|
assert.equal(aclaccess.get('state').info, accessState('Abc').noAccess.info, 'pageState without errors');
|
|
});
|