mirror of
https://github.com/grafana/grafana.git
synced 2025-01-06 22:23:19 -06:00
47abf44224
* Add a test assertion function to make testing a little bit easier * Add tests for SharedPreferences * Remove some tests from UserProfileEditPage because we're testing SharedPreferences directly now
11 lines
295 B
TypeScript
11 lines
295 B
TypeScript
export function assertInstanceOf<T extends { new (...args: unknown[]): InstanceType<T> }>(
|
|
value: unknown,
|
|
type: T
|
|
): InstanceType<T> {
|
|
if (!(value instanceof type)) {
|
|
throw new Error(`Expected value to be an instanceof ${typeof type} but got ${typeof value}`);
|
|
}
|
|
|
|
return value;
|
|
}
|