webpack/scenes/Subscriptions/__tests__/SubscriptionValidations.test.js in katello-3.10.2 vs webpack/scenes/Subscriptions/__tests__/SubscriptionValidations.test.js in katello-3.11.0.rc1
- old
+ new
@@ -42,33 +42,38 @@
it('skips quantity detection', () => {
expect(validateQuantity(100))
.toEqual(validResult);
});
+
+ it('detects unlimited maxQuantity', () => {
+ expect(validateQuantity('500000', -1))
+ .toEqual(validResult);
+ });
});
describe('recordsValid', () => {
it('accepts empty array', () => {
expect(recordsValid([])).toBe(true);
});
/* eslint-disable object-curly-newline */
it('accepts valid array', () => {
const rows = [
- { quantity: 10, available: 10, availableQuantity: 100, upstream_pool_id: ' ' },
- { quantity: 10, available: 10, availableQuantity: -1 },
+ { quantity: 10, available: 10, upstreamAvailable: 100, upstream_pool_id: ' ' },
+ { quantity: 10, available: 10, upstreamAvailable: -1 },
{ quantity: -1, available: -1 },
{ quantity: 10, available: 10, upstream_pool_id: ' ' },
];
expect(recordsValid(rows)).toBe(true);
});
/* eslint-enable object-curly-newline */
it('detects invalid record', () => {
/* eslint-disable object-curly-newline */
const rows = [
- { quantity: 10, available: 10, availableQuantity: 100, upstream_pool_id: ' ' },
- { quantity: 10, available: 10, availableQuantity: 5, upstream_pool_id: ' ' },
+ { quantity: 10, available: 10, upstreamAvailable: 100, maxQuantity: 100, upstream_pool_id: ' ' },
+ { quantity: 10, available: 10, upstreamAvailable: 0, maxQuantity: 5, upstream_pool_id: ' ' },
];
/* eslint-enable object-curly-newline */
expect(recordsValid(rows)).toBe(false);
});
});