|
| 1 | +// Copyright (c) 2021-2023 Uber Technologies Inc. |
| 2 | +// |
| 3 | +// |
| 4 | +// Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 | +// of this software and associated documentation files (the "Software"), to deal |
| 6 | +// in the Software without restriction, including without limitation the rights |
| 7 | +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 8 | +// copies of the Software, and to permit persons to whom the Software is |
| 9 | +// furnished to do so, subject to the following conditions: |
| 10 | +// |
| 11 | +// The above copyright notice and this permission notice shall be included in |
| 12 | +// all copies or substantial portions of the Software. |
| 13 | +// |
| 14 | +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 18 | +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 19 | +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 20 | +// THE SOFTWARE. |
| 21 | + |
| 22 | +import { ROUTE_PARAMS_DOMAIN } from '../route/getter-types'; |
| 23 | +import { |
| 24 | + CROSS_REGION, |
| 25 | + CROSS_REGION_CLUSTER_ORIGIN_LIST, |
| 26 | +} from '../cross-region/getter-types'; |
| 27 | +import { DOMAIN_HASH, DOMAIN_IS_READY } from '../domain/getter-types'; |
| 28 | +import activeStatusGetterFns from './getters'; |
| 29 | +import { ACTIVE_STATUS_CLUSTER_LIST } from './getter-types'; |
| 30 | +import { initGetters } from '~test'; |
| 31 | + |
| 32 | +describe('Active status getters', () => { |
| 33 | + describe('when calling getters[ACTIVE_STATUS_CLUSTER_LIST]', () => { |
| 34 | + it('should return empty array if its dynamic dependent getters returned Nil', () => { |
| 35 | + const dependentGetterNames = [ |
| 36 | + CROSS_REGION_CLUSTER_ORIGIN_LIST, |
| 37 | + CROSS_REGION, |
| 38 | + ROUTE_PARAMS_DOMAIN, |
| 39 | + ]; |
| 40 | + |
| 41 | + dependentGetterNames.forEach(getterName => { |
| 42 | + const getterFns = { |
| 43 | + ...activeStatusGetterFns, |
| 44 | + [getterName]: () => null, |
| 45 | + [DOMAIN_IS_READY]: () => true, |
| 46 | + [DOMAIN_HASH]: () => ({}), |
| 47 | + }; |
| 48 | + const getters = initGetters({ getterFns }); |
| 49 | + const output = getters[ACTIVE_STATUS_CLUSTER_LIST]; |
| 50 | + |
| 51 | + expect(output).toEqual([]); |
| 52 | + }); |
| 53 | + }); |
| 54 | + }); |
| 55 | +}); |
0 commit comments