UNPKG

@zendesk/react-measure-timing-hooks

Version:

react hooks for measuring time to interactive and time to render of components

57 lines 1.48 kB
"use strict"; /** * Copyright Zendesk, Inc. * * Use of this source code is governed under the Apache License, Version 2.0 * found at http://www.apache.org/licenses/LICENSE-2.0. */ Object.defineProperty(exports, "__esModule", { value: true }); const switchFn_1 = require("./switchFn"); describe('switchFn', () => { it('uses the correct 2nd return value for a case', () => { expect((0, switchFn_1.switchFn)({ case: false, return: 1, }, { case: true, return: 2, }, { return: 3, })).toBe(2); }); it('uses the correct return value for a case even when there are other matching cases later on', () => { expect((0, switchFn_1.switchFn)({ case: false, return: 1, }, { case: false, return: 2, }, { case: true, return: 3, }, { case: false, return: 4, }, { case: true, return: 5, }, { case: true, return: 6, }, { return: 7, })).toBe(3); }); it('uses the default case if no value matches', () => { expect((0, switchFn_1.switchFn)({ case: false, return: 1, }, { case: false, return: 2, }, { return: 3, })).toBe(3); }); }); //# sourceMappingURL=switchFn.test.js.map