diff options
author | 94117nl <rttededersixtwo@gmail.com> | 2017-08-03 15:24:30 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2017-08-03 16:24:30 -0400 |
commit | 304377c427d8db950fa436e2059e770baaf67405 (patch) | |
tree | e8373c8f020655b5d7a0eb3832e4fddecca08ad9 /webapp/tests/components | |
parent | 3174c9a07d780eb8f6e2fce8266013f393de40dd (diff) | |
download | chat-304377c427d8db950fa436e2059e770baaf67405.tar.gz chat-304377c427d8db950fa436e2059e770baaf67405.tar.bz2 chat-304377c427d8db950fa436e2059e770baaf67405.zip |
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
Diffstat (limited to 'webapp/tests/components')
-rw-r--r-- | webapp/tests/components/integrations/__snapshots__/installed_oauth_apps.test.jsx.snap | 98 | ||||
-rw-r--r-- | webapp/tests/components/integrations/installed_oauth_apps.test.jsx | 53 |
2 files changed, 151 insertions, 0 deletions
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`] = ` +<BackstageList + addLink="/test/integrations/oauth2-apps/add" + addText="Add OAuth 2.0 Application" + emptyText={ + <FormattedMessage + defaultMessage="No OAuth 2.0 Applications found" + id="installed_oauth_apps.empty" + values={Object {}} + /> + } + header={ + <FormattedMessage + defaultMessage="OAuth 2.0 Applications" + id="installed_oauth_apps.header" + values={Object {}} + /> + } + helpText={ + <FormattedMessage + defaultMessage="Create {oauthApplications} to securely integrate bots and third-party apps with Mattermost. Visit the {appDirectory} to find available self-hosted apps." + id="installed_oauth_apps.help" + values={ + Object { + "appDirectory": <a + href="https://about.mattermost.com/default-app-directory/" + rel="noopener noreferrer" + target="_blank" + > + <FormattedMessage + defaultMessage="App Directory" + id="installed_oauth_apps.help.appDirectory" + values={Object {}} + /> + </a>, + "oauthApplications": <a + href="https://docs.mattermost.com/developer/oauth-2-0-applications.html" + rel="noopener noreferrer" + target="_blank" + > + <FormattedMessage + defaultMessage="OAuth 2.0 applications" + id="installed_oauth_apps.help.oauthApplications" + values={Object {}} + /> + </a>, + } + } + /> + } + loading={true} + searchPlaceholder="Search OAuth 2.0 Applications" +> + <InstalledOAuthApp + oauthApp={ + Object { + "callback_urls": Array [ + "https://test.com/callback", + ], + "client_secret": "88cxd9wpzpbpfp8pad78xj75pr", + "create_at": 1501365458934, + "creator_id": "88oybd1dwfdoxpkpw1h5kpbyco", + "description": "testing", + "homepage": "https://test.com", + "icon_url": "https://test.com/icon", + "id": "facxd9wpzpbpfp8pad78xj75pr", + "is_trusted": false, + "name": "firstApp", + "update_at": 1501365458934, + } + } + onDelete={[Function]} + /> + <InstalledOAuthApp + oauthApp={ + Object { + "callback_urls": Array [ + "https://test2.com/callback", + "https://test2.com/callback2", + ], + "client_secret": "decxd9wpzpbpfp8pad78xj75pr", + "create_at": 1501365459984, + "creator_id": "88oybd2dwfdoxpkpw1h5kpbyco", + "description": "testing2", + "homepage": "https://test2.com", + "icon_url": "https://test2.com/icon", + "id": "fzcxd9wpzpbpfp8pad78xj75pr", + "is_trusted": true, + "name": "secondApp", + "update_at": 1501365479988, + } + } + onDelete={[Function]} + /> +</BackstageList> +`; 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( + <InstalledOAuthApps + team={{name: 'test'}} + oauthApps={oauthApps} + isSystemAdmin={true} + actions={{getOAuthApps: emptyFunction, deleteOAuthApp: emptyFunction}} + /> + ); + expect(wrapper.find('InstalledOAuthApp').length).toBe(2); + expect(wrapper).toMatchSnapshot(); + }); +});
\ No newline at end of file |