Sha256: e08517384ac77a8bce4a927da305657b67156c634367401dd74860f8b5322173
Contents?: true
Size: 1.92 KB
Versions: 56
Compression:
Stored size: 1.92 KB
Contents
import { quantitiesRequestSuccessResponse, loadQuantitiesSuccessActionPayload, } from './subscriptions.fixtures'; import { filterRHSubscriptions, manifestExists, selectSubscriptionsQuantitiesFromResponse, } from '../SubscriptionHelpers'; describe('Subscription helper', () => { it('should filter subscriptions without upstream_pool_id', () => { const subscriptions = [ { key: 'sub-1', available: 3, }, { key: 'sub-2', available: 4, upstream_pool_id: ' ', }, { key: 'sub-3', available: -5, upstream_pool_id: ' ', }, { key: 'sub-4', available: -1, }, ]; const filteredSubscriptions = filterRHSubscriptions(subscriptions); expect(filteredSubscriptions).toMatchSnapshot(); }); it('should filter redhat subscriptions', () => { const subscriptions = [ { key: 'sub-1', available: 0, upstream_pool_id: ' ', }, { key: 'sub-2', available: 4, upstream_pool_id: ' ', }, { key: 'sub-3', available: -5, upstream_pool_id: ' ', }, { key: 'sub-4', available: 100, upstream_pool_id: ' ', }, ]; const filteredSubscriptions = filterRHSubscriptions(subscriptions); expect(filteredSubscriptions).toMatchSnapshot(); }); it('should check if manifest exists in an organization', () => { const upstreamConsumer = 'some-upstream-consumer'; expect(manifestExists({ owner_details: { upstreamConsumer }, })).toBe(upstreamConsumer); expect(manifestExists({})).toBeFalsy(); }); it('should select subscriptions-quantities from api response', () => { const quantities = selectSubscriptionsQuantitiesFromResponse(quantitiesRequestSuccessResponse); expect(quantities).toEqual(loadQuantitiesSuccessActionPayload); }); });
Version data entries
56 entries across 56 versions & 1 rubygems