mirror of
https://github.com/apache/superset.git
synced 2026-04-10 20:06:13 +00:00
* bumping the js libs * New linting rules * More linting * More * Done linting * npm >=4.5.0 * Bumping node * Tweaking the build * Fixing the damn build * Fixing the apps
37 lines
1.2 KiB
JavaScript
37 lines
1.2 KiB
JavaScript
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import { describe, it } from 'mocha';
|
|
import { expect } from 'chai';
|
|
|
|
import { user, userNoPerms } from './fixtures';
|
|
import Security from '../../../javascripts/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);
|
|
});
|
|
});
|