mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 22:29:01 +02:00
2ef5db2938
[web] Clean up localized currency format test (`local-ccy-format-v2`) GitOrigin-RevId: 30d671479522b87ee9205994508b745d2b0ae4c3
78 lines
2.2 KiB
JavaScript
78 lines
2.2 KiB
JavaScript
import { expect } from 'chai'
|
||
import { createLocalizedGroupPlanPrice } from '../../../../frontend/js/features/plans/utils/group-plan-pricing'
|
||
|
||
describe('group-plan-pricing', function () {
|
||
beforeEach(function () {
|
||
window.metaAttributesCache.set('ol-groupPlans', {
|
||
enterprise: {
|
||
professional: {
|
||
CHF: {
|
||
2: {
|
||
price_in_cents: 10000,
|
||
},
|
||
},
|
||
DKK: {
|
||
2: {
|
||
price_in_cents: 20000,
|
||
},
|
||
},
|
||
USD: {
|
||
2: {
|
||
price_in_cents: 30000,
|
||
},
|
||
},
|
||
},
|
||
},
|
||
})
|
||
window.metaAttributesCache.set('ol-i18n', { currentLangCode: 'en' })
|
||
})
|
||
|
||
describe('createLocalizedGroupPlanPrice', function () {
|
||
describe('CHF currency', function () {
|
||
it('should return the correct localized price', function () {
|
||
const localizedGroupPlanPrice = createLocalizedGroupPlanPrice({
|
||
plan: 'professional',
|
||
currency: 'CHF',
|
||
licenseSize: '2',
|
||
usage: 'enterprise',
|
||
})
|
||
|
||
expect(localizedGroupPlanPrice).to.deep.equal({
|
||
localizedPrice: 'CHF 100',
|
||
localizedPerUserPrice: 'CHF 50',
|
||
})
|
||
})
|
||
})
|
||
describe('DKK currency', function () {
|
||
it('should return the correct localized price', function () {
|
||
const localizedGroupPlanPrice = createLocalizedGroupPlanPrice({
|
||
plan: 'professional',
|
||
currency: 'DKK',
|
||
licenseSize: '2',
|
||
usage: 'enterprise',
|
||
})
|
||
|
||
expect(localizedGroupPlanPrice).to.deep.equal({
|
||
localizedPrice: 'kr 200',
|
||
localizedPerUserPrice: 'kr 100',
|
||
})
|
||
})
|
||
})
|
||
describe('other supported currencies', function () {
|
||
it('should return the correct localized price', function () {
|
||
const localizedGroupPlanPrice = createLocalizedGroupPlanPrice({
|
||
plan: 'professional',
|
||
currency: 'USD',
|
||
licenseSize: '2',
|
||
usage: 'enterprise',
|
||
})
|
||
|
||
expect(localizedGroupPlanPrice).to.deep.equal({
|
||
localizedPrice: '$300',
|
||
localizedPerUserPrice: '$150',
|
||
})
|
||
})
|
||
})
|
||
})
|
||
})
|