Commit 12ae35f8 authored by Angelo Gulina's avatar Angelo Gulina Committed by Scott Hampton

SuperSonics: unlimited users

parent 3ca18ac9
...@@ -8,6 +8,7 @@ import { ...@@ -8,6 +8,7 @@ import {
maximumUsersTitle, maximumUsersTitle,
usersInSubscriptionText, usersInSubscriptionText,
usersInSubscriptionTitle, usersInSubscriptionTitle,
usersInSubscriptionUnlimited,
usersOverSubscriptionText, usersOverSubscriptionText,
usersOverSubscriptionTitle, usersOverSubscriptionTitle,
} from '../constants'; } from '../constants';
...@@ -44,7 +45,7 @@ export default { ...@@ -44,7 +45,7 @@ export default {
}, },
computed: { computed: {
usersInSubscription() { usersInSubscription() {
return this.subscription.usersInLicenseCount; return this.subscription.usersInLicenseCount ?? usersInSubscriptionUnlimited;
}, },
billableUsers() { billableUsers() {
return this.subscription.billableUsersCount; return this.subscription.billableUsersCount;
...@@ -62,7 +63,7 @@ export default { ...@@ -62,7 +63,7 @@ export default {
<template> <template>
<section class="row"> <section class="row">
<div class="col-md-6 gl-mb-5"> <div class="col-md-6 gl-mb-5">
<gl-card data-testid="users-in-license"> <gl-card data-testid="users-in-subscription">
<header> <header>
<h2>{{ usersInSubscription }}</h2> <h2>{{ usersInSubscription }}</h2>
<h5 class="gl-font-weight-normal text-uppercase"> <h5 class="gl-font-weight-normal text-uppercase">
......
...@@ -13,6 +13,7 @@ export const manageSubscriptionButtonText = s__('SuperSonics|Manage'); ...@@ -13,6 +13,7 @@ export const manageSubscriptionButtonText = s__('SuperSonics|Manage');
export const syncSubscriptionButtonText = s__('SuperSonics|Sync subscription details'); export const syncSubscriptionButtonText = s__('SuperSonics|Sync subscription details');
export const copySubscriptionIdButtonText = __('Copy'); export const copySubscriptionIdButtonText = __('Copy');
export const subscriptionTypeText = __('%{type} License'); export const subscriptionTypeText = __('%{type} License');
export const usersInSubscriptionUnlimited = __('Unlimited');
export const detailsLabels = { export const detailsLabels = {
address: __('Address'), address: __('Address'),
company: __('Company'), company: __('Company'),
......
...@@ -21,6 +21,8 @@ describe('Subscription Details User Info', () => { ...@@ -21,6 +21,8 @@ describe('Subscription Details User Info', () => {
let wrapper; let wrapper;
const itif = (condition) => (condition ? it : it.skip); const itif = (condition) => (condition ? it : it.skip);
const findSubscriptionText = () =>
wrapper.findByTestId('users-in-subscription').find('h2').text();
const createComponent = (props = {}, stubGlSprintf = false) => { const createComponent = (props = {}, stubGlSprintf = false) => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
...@@ -42,11 +44,11 @@ describe('Subscription Details User Info', () => { ...@@ -42,11 +44,11 @@ describe('Subscription Details User Info', () => {
}); });
describe.each` describe.each`
testId | info | title | text | link testId | info | title | text | link
${'users-in-license'} | ${'10'} | ${usersInSubscriptionTitle} | ${usersInSubscriptionText} | ${false} ${'users-in-subscription'} | ${'10'} | ${usersInSubscriptionTitle} | ${usersInSubscriptionText} | ${false}
${'billable-users'} | ${'8'} | ${billableUsersTitle} | ${billableUsersText} | ${billableUsersURL} ${'billable-users'} | ${'8'} | ${billableUsersTitle} | ${billableUsersText} | ${billableUsersURL}
${'maximum-users'} | ${'8'} | ${maximumUsersTitle} | ${maximumUsersText} | ${false} ${'maximum-users'} | ${'8'} | ${maximumUsersTitle} | ${maximumUsersText} | ${false}
${'users-over-license'} | ${'0'} | ${usersOverSubscriptionTitle} | ${usersOverSubscriptionText} | ${trueUpURL} ${'users-over-license'} | ${'0'} | ${usersOverSubscriptionTitle} | ${usersOverSubscriptionText} | ${trueUpURL}
`('with data for $card', ({ testId, info, title, text, link }) => { `('with data for $card', ({ testId, info, title, text, link }) => {
beforeEach(() => { beforeEach(() => {
createComponent(); createComponent();
...@@ -80,4 +82,20 @@ describe('Subscription Details User Info', () => { ...@@ -80,4 +82,20 @@ describe('Subscription Details User Info', () => {
expect(findUseCard().findComponent(GlLink).exists()).toBe(link); expect(findUseCard().findComponent(GlLink).exists()).toBe(link);
}); });
}); });
describe('Users is subscription', () => {
it('should display the value when present', () => {
const subscription = { ...license.ULTIMATE, usersInLicenseCount: 0 };
createComponent({ subscription });
expect(findSubscriptionText()).toBe('0');
});
it('should display Unlimited when users in license is null', () => {
const subscription = { ...license.ULTIMATE, usersInLicenseCount: null };
createComponent({ subscription });
expect(findSubscriptionText()).toBe('Unlimited');
});
});
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment