@grafana/data#OrgRole TypeScript Examples

The following examples show how to use @grafana/data#OrgRole. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OrgSwitcher.test.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
describe('OrgSwitcher', () => {
  describe('when switching org', () => {
    beforeEach(async () => {
      wrapper = shallow(<OrgSwitcher onDismiss={() => {}} />);
      orgSwitcher = wrapper.instance() as OrgSwitcher;
      orgSwitcher.setWindowLocation = jest.fn();
      wrapper.update();
      await orgSwitcher.setCurrentOrg({ name: 'mock org', orgId: 2, role: OrgRole.Viewer });
    });

    it('should switch orgId in call to backend', () => {
      expect(postMock).toBeCalledWith('/api/user/using/2');
    });

    it('should switch orgId in url and redirect to home page', () => {
      expect(orgSwitcher.setWindowLocation).toBeCalledWith('/subUrl/?orgId=2');
    });
  });
});