mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fixed a small bug and added case sensitivity
This commit is contained in:
@@ -46,7 +46,7 @@ describe('actionCreatorFactory', () => {
|
||||
setup(payload);
|
||||
|
||||
expect(() => {
|
||||
actionCreatorFactory<Dummy>('dummy').create();
|
||||
actionCreatorFactory<Dummy>('DuMmY').create();
|
||||
}).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ export const actionCreatorFactory = <Payload>(type: string): ActionCreatorFactor
|
||||
return Object.assign((payload: Payload): GrafanaAction<Payload> => ({ type, payload }), { type });
|
||||
};
|
||||
|
||||
if (allActionCreators.some(t => type === type)) {
|
||||
if (allActionCreators.some(t => (t && type ? t.toLocaleUpperCase() === type.toLocaleUpperCase() : false))) {
|
||||
throw new Error(`There is already an actionCreator defined with the type ${type}`);
|
||||
}
|
||||
|
||||
@@ -30,4 +30,5 @@ export const actionCreatorFactory = <Payload>(type: string): ActionCreatorFactor
|
||||
return { create };
|
||||
};
|
||||
|
||||
// Should only be used by tests
|
||||
export const resetAllActionCreatorTypes = () => (allActionCreators.length = 0);
|
||||
|
||||
Reference in New Issue
Block a user