mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 05:23:04 +00:00
9d21736e9f
* Add copyright headers to UI files * Ensure copywrite file ignores external libs
24 lines
656 B
JavaScript
24 lines
656 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import maybeCall from 'consul-ui/utils/maybe-call';
|
|
import { module, test } from 'qunit';
|
|
import { Promise } from 'rsvp';
|
|
|
|
module('Unit | Utility | maybe-call', function () {
|
|
test('it calls a function when the resolved value is true', function (assert) {
|
|
assert.expect(1);
|
|
return maybeCall(() => {
|
|
assert.ok(true);
|
|
}, Promise.resolve(true))();
|
|
});
|
|
test("it doesn't call a function when the resolved value is false", function (assert) {
|
|
assert.expect(0);
|
|
return maybeCall(() => {
|
|
assert.ok(true);
|
|
}, Promise.resolve(false))();
|
|
});
|
|
});
|