mirror of
https://github.com/apache/superset.git
synced 2026-04-13 05:07:53 +00:00
* [lint] turn no-undef back on, set browser, cypress, and mocha env's, and fix issues * [lint] fix undefined var in TimeTable.jsx
36 lines
1.2 KiB
JavaScript
36 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import { expect } from 'chai';
|
|
|
|
import { user, userNoPerms } from './fixtures';
|
|
import Security from '../../../src/profile/components/Security';
|
|
|
|
|
|
describe('Security', () => {
|
|
const mockedProps = {
|
|
user,
|
|
};
|
|
it('is valid', () => {
|
|
expect(
|
|
React.isValidElement(<Security {...mockedProps} />),
|
|
).to.equal(true);
|
|
});
|
|
it('renders 2 role labels', () => {
|
|
const wrapper = mount(<Security {...mockedProps} />);
|
|
expect(wrapper.find('.roles').find('.label')).to.have.length(2);
|
|
});
|
|
it('renders 2 datasource labels', () => {
|
|
const wrapper = mount(<Security {...mockedProps} />);
|
|
expect(wrapper.find('.datasources').find('.label')).to.have.length(2);
|
|
});
|
|
it('renders 3 database labels', () => {
|
|
const wrapper = mount(<Security {...mockedProps} />);
|
|
expect(wrapper.find('.databases').find('.label')).to.have.length(3);
|
|
});
|
|
it('renders no permission label when empty', () => {
|
|
const wrapper = mount(<Security user={userNoPerms} />);
|
|
expect(wrapper.find('.datasources').find('.label')).to.have.length(0);
|
|
expect(wrapper.find('.databases').find('.label')).to.have.length(0);
|
|
});
|
|
});
|