Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions public/apps/account/test/account-nav-button.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ describe('Account navigation button', () => {

const config = {
multitenancy: {
enabled: 'true',
enabled: true,
tenants: {
enable_private: 'true',
enable_global: 'true',
enable_private: true,
enable_global: true,
},
},
auth: {
Expand Down Expand Up @@ -102,3 +102,43 @@ describe('Account navigation button', () => {
expect(setState).toBeCalledTimes(1);
});
});

describe('Account navigation button, multitenancy disabled', () => {
const mockCoreStart = {
http: 1,
};

const config = {
multitenancy: {
enabled: false,
},
auth: {
type: 'dummy',
},
};

const userName = 'user1';
const setState = jest.fn();
const useStateSpy = jest.spyOn(React, 'useState');

beforeEach(() => {
useStateSpy.mockImplementation((init) => [init, setState]);
});

afterEach(() => {
jest.clearAllMocks();
});

it('should not set modal when show popup is true', () => {
(getShouldShowTenantPopup as jest.Mock).mockReturnValueOnce(true);
shallow(
<AccountNavButton
coreStart={mockCoreStart}
isInternalUser={true}
username={userName}
config={config as any}
/>
);
expect(setState).toBeCalledTimes(0);
});
});