Files
superset2/superset/assets/spec/javascripts/profile/Security_spec.jsx
Chris Williams b453cd2bf2 [lint] turn no-undef back on, set browser, cypress, and mocha env's (#5879)
* [lint] turn no-undef back on, set browser, cypress, and mocha env's, and fix issues

* [lint] fix undefined var in TimeTable.jsx
2018-09-13 14:45:24 -07:00

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