3 * Copyright (C) 2009-2021 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 import { shallow } from 'enzyme';
21 import * as React from 'react';
22 import { EditionKey } from '../../../../../types/editions';
23 import SystemUpgradeItem, { SystemUpgradeItemProps } from '../SystemUpgradeItem';
25 it('should display correctly', () => {
26 expect(shallowRender()).toMatchSnapshot();
27 expect(shallowRender({ isLatestVersion: false })).toMatchSnapshot();
28 expect(shallowRender({ edition: EditionKey.developer })).toMatchSnapshot();
29 expect(shallowRender({ edition: EditionKey.enterprise })).toMatchSnapshot();
30 expect(shallowRender({ edition: EditionKey.datacenter })).toMatchSnapshot();
31 // Fallback to Community.
37 description: 'Version 5.6.7 description',
38 releaseDate: '2017-03-01',
39 changeLogUrl: 'http://changelog.url/',
40 downloadUrl: 'http://download.url/community'
47 function shallowRender(props: Partial<SystemUpgradeItemProps> = {}) {
48 return shallow<SystemUpgradeItemProps>(
50 edition={EditionKey.community}
54 description: 'Version 5.6.7 description',
55 releaseDate: '2017-03-01',
56 changeLogUrl: 'http://changelog.url/',
57 downloadUrl: 'http://download.url/community',
58 downloadDeveloperUrl: 'http://download.url/developer',
59 downloadEnterpriseUrl: 'http://download.url/enterprise',
60 downloadDatacenterUrl: 'http://download.url/datacenter'
64 description: 'Version 5.6.6 description',
65 releaseDate: '2017-04-02',
66 changeLogUrl: 'http://changelog.url/',
67 downloadUrl: 'http://download.url/community',
68 downloadDeveloperUrl: 'http://download.url/developer'
72 description: 'Version 5.6.5 description',
73 releaseDate: '2017-03-01',
74 changeLogUrl: 'http://changelog.url/',
75 downloadUrl: 'http://download.url/community',
76 downloadDeveloperUrl: 'http://download.url/developer'
79 isLatestVersion={true}