mattermost-mobile/app/screens/report_a_problem/log_file_item.test.tsx
Daniel Espino García 5c2153f83b
Add Report a Problem functionality (#8605)
* Add Report a Problem functionality

* update cache pinned SHA version from 4.0.2 to 4.2.0

* Address feedback

* Fix tests

* Fix some issues and update kotlin coroutines version

* Fix delete file for iOS

* Bump 1 more version for coroutines

* Use rxjava instead of kotlin coroutines to avoid security issue

* Move path prefix to avoid test error

* Address feedback

* Address feedback

* Address feedback

* Use mailto on iOS

* Fix tests related to button changes

* Address feedback

* Update icon and fix onboarding buttons

* Fix test

---------

Co-authored-by: Angelos Kyratzakos <angelos.kyratzakos@mattermost.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
2025-04-24 11:12:55 +02:00

48 lines
1.2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {render, waitFor} from '@testing-library/react-native';
import React from 'react';
import LogFileItem from './log_file_item';
jest.mock('@utils/file', () => ({
...jest.requireActual('@utils/file'),
getFileSize: jest.fn(),
}));
describe('screens/report_a_problem/log_file_item', () => {
beforeEach(() => {
jest.clearAllMocks();
});
it('renders log file item with correct filename', async () => {
const {getByText} = render(
<LogFileItem/>,
);
await waitFor(() => {
expect(getByText(/Logs_/)).toBeTruthy();
});
});
it('displays file type', async () => {
const {getByText} = render(
<LogFileItem/>,
);
await waitFor(() => {
expect(getByText('ZIP')).toBeTruthy();
});
});
it('displays file icon', async () => {
const {getByTestId} = render(
<LogFileItem/>,
);
await waitFor(() => {
const icon = getByTestId('log-file-icon');
expect(icon.props.name).toBe('file-zip-outline-large');
});
});
});