grafana/public/app/features/datasources/utils/passwordHandlers.test.ts
Torkel Ödegaard 1d689888b0
Prettier: Upgrade to 2 (#30387)
* Updated package json but not updated source files

* Update eslint plugin

* updated files
2021-01-20 07:59:48 +01:00

33 lines
796 B
TypeScript

import { createResetHandler, PasswordFieldEnum, Ctrl } from './passwordHandlers';
describe('createResetHandler', () => {
Object.values(PasswordFieldEnum).forEach((field) => {
it(`should reset existing ${field} field`, () => {
const event: any = {
preventDefault: () => {},
};
const ctrl: Ctrl = {
current: {
[field]: 'set',
secureJsonData: {
[field]: 'set',
},
secureJsonFields: {},
},
};
createResetHandler(ctrl, field)(event);
expect(ctrl).toEqual({
current: {
[field]: undefined,
secureJsonData: {
[field]: '',
},
secureJsonFields: {
[field]: false,
},
},
});
});
});
});