mirror of
https://github.com/grafana/grafana.git
synced 2025-01-26 16:27:02 -06:00
1d689888b0
* Updated package json but not updated source files * Update eslint plugin * updated files
33 lines
796 B
TypeScript
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,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
});
|
|
});
|