signal-desktop/ts/test-both/util/isNotNil_test.ts
2021-03-19 16:53:52 -04:00

24 lines
638 B
TypeScript

// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from 'chai';
import { isNotNil } from '../../util/isNotNil';
describe('isNotNil', () => {
it('returns false if provided null value', () => {
assert.isFalse(isNotNil(null));
});
it('returns false is provided undefined value', () => {
assert.isFalse(isNotNil(undefined));
});
it('returns false is provided any other value', () => {
assert.isTrue(isNotNil(0));
assert.isTrue(isNotNil(4));
assert.isTrue(isNotNil(''));
assert.isTrue(isNotNil('string value'));
assert.isTrue(isNotNil({}));
});
});