Additional tests (w/ lazy) (#1174)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Copyright 2017-2021 @polkadot/util authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { assert } from '.';
|
||||
import { assert, assertReturn } from '.';
|
||||
|
||||
describe('assert', (): void => {
|
||||
it('should not throw an error when test is true', (): void => {
|
||||
@@ -20,3 +20,19 @@ describe('assert', (): void => {
|
||||
).toThrow(/message from function/);
|
||||
});
|
||||
});
|
||||
|
||||
describe('assertReturn', (): void => {
|
||||
it('should not throw an error when result is true', (): void => {
|
||||
expect(assertReturn(true, 'nothing should be thrown')).toEqual(true);
|
||||
});
|
||||
|
||||
it('should not throw an error when result is false', (): void => {
|
||||
expect(assertReturn(false, 'nothing should be thrown')).toEqual(false);
|
||||
});
|
||||
|
||||
it('should throw an error when result is undefined', (): void => {
|
||||
expect(
|
||||
() => assertReturn(undefined, 'something thrown')
|
||||
).toThrow(/something thrown/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user