* Playbook run status update post * Show Playbooks button in Channel Info screen only if playbooks is enabled * Handle Playbook links * Fetch playbook if needed * fix playbooks migration * fix deeplinks using parsedUrl * update last time playbooks where fetched if no errors * show participants for run status update post * fix tests * remove console.log in test * feedback review * wrap participants footer * add fastlane FASTLANE_XCODEBUILD_SETTINGS_RETRIES env vars
49 lines
1.9 KiB
TypeScript
49 lines
1.9 KiB
TypeScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import React, {type ComponentProps} from 'react';
|
|
|
|
import DatabaseManager from '@database/manager';
|
|
import PlaybookRunsOption from '@playbooks/components/channel_actions/playbook_runs_option';
|
|
import {renderWithEverything} from '@test/intl-test-helper';
|
|
|
|
import ChannelInfoOptions from './';
|
|
|
|
import type {Database} from '@nozbe/watermelondb';
|
|
|
|
const serverUrl = 'some.server.url';
|
|
|
|
jest.mock('@playbooks/components/channel_actions/playbook_runs_option');
|
|
jest.mocked(PlaybookRunsOption).mockImplementation((props) => {
|
|
return React.createElement('PlaybookRunsOption', {...props, testID: 'playbook-runs-option'});
|
|
});
|
|
|
|
describe('ChannelInfoOptions', () => {
|
|
let database: Database;
|
|
|
|
function getBaseProps(): ComponentProps<typeof ChannelInfoOptions> {
|
|
return {
|
|
channelId: 'channel-id',
|
|
callsEnabled: false,
|
|
canManageMembers: false,
|
|
isCRTEnabled: false,
|
|
canManageSettings: false,
|
|
isPlaybooksEnabled: true,
|
|
};
|
|
}
|
|
beforeEach(async () => {
|
|
await DatabaseManager.init([serverUrl]);
|
|
const serverDatabaseAndOperator = DatabaseManager.getServerDatabaseAndOperator(serverUrl);
|
|
database = serverDatabaseAndOperator.database;
|
|
});
|
|
it('should pass the channel id correctly to the PlaybookRunsOption', () => {
|
|
const props = getBaseProps();
|
|
const {getByTestId, rerender} = renderWithEverything(<ChannelInfoOptions {...props}/>, {database});
|
|
expect(getByTestId('playbook-runs-option')).toHaveProp('channelId', 'channel-id');
|
|
expect(getByTestId('playbook-runs-option')).toHaveProp('location', 'channel_actions');
|
|
|
|
props.channelId = 'channel-id-2';
|
|
rerender(<ChannelInfoOptions {...props}/>);
|
|
expect(getByTestId('playbook-runs-option')).toHaveProp('channelId', 'channel-id-2');
|
|
});
|
|
});
|