From 304377c427d8db950fa436e2059e770baaf67405 Mon Sep 17 00:00:00 2001 From: 94117nl Date: Thu, 3 Aug 2017 15:24:30 -0500 Subject: PLT-6455 Migrate installed_oauth_apps.jsx to be pure and use Redux (#7059) * Migrate installed_oauth_apps.jsx to be pure and use Redux * Props docs typo, add test, remove commands_container, bump yarn.lock --- .../installed_oauth_apps.test.jsx.snap | 98 ++++++++++++++++++++++ .../integrations/installed_oauth_apps.test.jsx | 53 ++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 webapp/tests/components/integrations/__snapshots__/installed_oauth_apps.test.jsx.snap create mode 100644 webapp/tests/components/integrations/installed_oauth_apps.test.jsx (limited to 'webapp/tests/components') diff --git a/webapp/tests/components/integrations/__snapshots__/installed_oauth_apps.test.jsx.snap b/webapp/tests/components/integrations/__snapshots__/installed_oauth_apps.test.jsx.snap new file mode 100644 index 000000000..022bc1476 --- /dev/null +++ b/webapp/tests/components/integrations/__snapshots__/installed_oauth_apps.test.jsx.snap @@ -0,0 +1,98 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`components/integrations/InstalledOAuthApps should match snapshot 1`] = ` + + } + header={ + + } + helpText={ + + + , + "oauthApplications": + + , + } + } + /> + } + loading={true} + searchPlaceholder="Search OAuth 2.0 Applications" +> + + + +`; diff --git a/webapp/tests/components/integrations/installed_oauth_apps.test.jsx b/webapp/tests/components/integrations/installed_oauth_apps.test.jsx new file mode 100644 index 000000000..4f3ca6ba8 --- /dev/null +++ b/webapp/tests/components/integrations/installed_oauth_apps.test.jsx @@ -0,0 +1,53 @@ +// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import React from 'react'; +import {shallow} from 'enzyme'; + +import InstalledOAuthApps from 'components/integrations/components/installed_oauth_apps/installed_oauth_apps.jsx'; + +describe('components/integrations/InstalledOAuthApps', () => { + test('should match snapshot', () => { + const emptyFunction = jest.fn(); + const oauthApps = { + facxd9wpzpbpfp8pad78xj75pr: { + id: 'facxd9wpzpbpfp8pad78xj75pr', + name: 'firstApp', + client_secret: '88cxd9wpzpbpfp8pad78xj75pr', + create_at: 1501365458934, + creator_id: '88oybd1dwfdoxpkpw1h5kpbyco', + description: 'testing', + homepage: 'https://test.com', + icon_url: 'https://test.com/icon', + is_trusted: false, + update_at: 1501365458934, + callback_urls: ['https://test.com/callback'] + }, + fzcxd9wpzpbpfp8pad78xj75pr: { + id: 'fzcxd9wpzpbpfp8pad78xj75pr', + name: 'secondApp', + client_secret: 'decxd9wpzpbpfp8pad78xj75pr', + create_at: 1501365459984, + creator_id: '88oybd2dwfdoxpkpw1h5kpbyco', + description: 'testing2', + homepage: 'https://test2.com', + icon_url: 'https://test2.com/icon', + is_trusted: true, + update_at: 1501365479988, + callback_urls: ['https://test2.com/callback', 'https://test2.com/callback2'] + } + }; + global.window.mm_config = {EnableOAuthServiceProvider: 'true'}; + + const wrapper = shallow( + + ); + expect(wrapper.find('InstalledOAuthApp').length).toBe(2); + expect(wrapper).toMatchSnapshot(); + }); +}); \ No newline at end of file -- cgit v1.2.3-1-g7c22