Skip to content

Commit

Permalink
Add unit tests for new user login filter input
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Rak <[email protected]>
  • Loading branch information
rak-phillip committed Feb 26, 2025
1 parent 32dd237 commit 1fa73c0
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions shell/edit/auth/ldap/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,44 @@ describe('lDAP config', () => {

expect(checkbox).toBeDefined();
});

it('updates user login filter when value is entered', async() => {
const wrapper = mount(
LDAPConfig,
{
props: {
value: {},
type: 'openldap',
}
});

const userLoginFilter = wrapper.find('[data-testid="user-login-filter"]');

await userLoginFilter.setValue('Test Filter');

const expectedValue = 'Test Filter';

expect(userLoginFilter.exists()).toBe(true);
expect(userLoginFilter.element.value).toBe(expectedValue);
expect(wrapper.vm.model.userLoginFilter).toBe(expectedValue);
});

it('defaults to undefined for user login filter', () => {
const wrapper = mount(
LDAPConfig,
{
props: {
value: {},
type: 'openldap',
}
});

const userLoginFilter = wrapper.find('[data-testid="user-login-filter"]');

const expectedValue = '';

expect(userLoginFilter.exists()).toBe(true);
expect(userLoginFilter.element.value).toBe(expectedValue);
expect(wrapper.vm.model.userLoginFilter).toBeUndefined();
});
});

0 comments on commit 1fa73c0

Please sign in to comment.