From cdb94c7d2b5a2fd76d240eb988eae4b7654c70db Mon Sep 17 00:00:00 2001 From: "Rochmar Nicolas (DevExpress)" Date: Fri, 14 Jun 2024 09:47:40 +0800 Subject: [PATCH] Fix buy link test --- .../core/license/license_validation.test.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/devextreme/js/__internal/core/license/license_validation.test.ts b/packages/devextreme/js/__internal/core/license/license_validation.test.ts index 2d6557986388..7f489f8df559 100644 --- a/packages/devextreme/js/__internal/core/license/license_validation.test.ts +++ b/packages/devextreme/js/__internal/core/license/license_validation.test.ts @@ -1,3 +1,4 @@ +import config from '@js/core/config'; import errors from '@js/core/errors'; import { base } from '../../ui/overlay/m_z_index'; @@ -274,7 +275,7 @@ describe('version mismatch', () => { }); }); -describe('license check', () => { +describe.only('license check', () => { const TOKEN_23_1 = 'ewogICJmb3JtYXQiOiAxLAogICJjdXN0b21lcklkIjogImIxMTQwYjQ2LWZkZTEtNDFiZC1hMjgwLTRkYjlmOGU3ZDliZCIsCiAgIm1heFZlcnNpb25BbGxvd2VkIjogMjMxCn0=.DiDceRbil4IzXl5av7pNkKieyqHHhRf+CM477zDu4N9fyrhkQsjRourYvgVfkbSm+EQplkXhlMBc3s8Vm9n+VtPaMbeWXis92cdW/6HiT+Dm54xw5vZ5POGunKRrNYUzd9zTbYcz0bYA/dc/mHFeUdXA0UlKcx1uMaXmtJrkK74='; const TOKEN_23_2 = 'ewogICJmb3JtYXQiOiAxLAogICJjdXN0b21lcklkIjogIjYxMjFmMDIyLTFjMTItNDNjZC04YWE0LTkwNzJkNDU4YjYxNCIsCiAgIm1heFZlcnNpb25BbGxvd2VkIjogMjMyCn0=.RENyZ3Ga5rCB7/XNKYbk2Ffv1n9bUexYNhyOlqcAD02YVnPw6XyQcN+ZORScKDU9gOInJ4o7vPxkgh10KvMZNn+FuBK8UcUR7kchk7z0CHGuOcIn2jD5X2hG6SYJ0UCBG/JDG35AL09T7Uv/pGj4PolRsANxtuMpoqmvX2D2vkU='; const TOKEN_UNVERIFIED = 'ewogICJmb3JtYXQiOiAxLAogICJjdXN0b21lcklkIjogImIxMTQwYjQ2LWZkZTEtNDFiZC1hMjgwLTRkYjlmOGU3ZDliZCIsCiAgIm1heFZlcnNpb25BbGxvd2VkIjogMjMxCn0=.NVsilC5uWlD5QGS6bocLMlsVVK0VpZXYwU2DstUiLRpEI79/onuR8dGWasCLBo4PORDHPkNA/Ej8XeCHzJ0EkXRRZ7E2LrP/xlEfHRXTruvW4IEbZt3LiwJBt6/isLz+wzXtYtjV7tpE07/Y0TFoy+mWpHoU11GVtwKh6weRxkg='; @@ -364,18 +365,17 @@ describe('license check', () => { expect(trialPanelSpy).not.toHaveBeenCalled(); }); - test.each([ - { token: '', version: '1.0.3' }, - { token: null, version: '1.0.4' }, - { token: undefined, version: '1.0.50' }, - { token: '', version: '1.0.0' }, - { token: null, version: '1.2.4-preview' }, - { token: undefined, version: '1.2' }, - ])('Buy now link is set correctly', ({ token, version }) => { - validateLicense(token as string, version); + test('Trial panel "Buy Now" link must use the jQuery link if no config has been set', () => { + validateLicense('', '1.2'); expect(trialPanelSpy?.mock.calls[0][0]).toBe('https://go.devexpress.com/Licensing_Installer_Watermark_DevExtremeJQuery.aspx'); }); + test('Trial panel "Buy Now" link must use the value from the config', () => { + config({ buyNowLink: 'trial-panel-link.com' }); + validateLicense('', '1.2'); + expect(trialPanelSpy?.mock.calls[0][0]).toBe('trial-panel-link.com'); + }); + test('Message should be logged only once', () => { validateLicense('', '1.0'); validateLicense('', '1.0');