文件
chen 301194963b
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

51 行
1.6 KiB
TypeScript

import * as React from 'react';
import { _ } from '@joplin/lib/locale';
import { act, fireEvent, render, waitFor } from '../../../../utils/testing/testingLibrary';
import { expect, describe, beforeEach, test, jest } from '@jest/globals';
import { createNTestNotes, setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
import Folder from '@joplin/lib/models/Folder';
import configScreenStyles from '../configScreenStyles';
import { type ShareOptions } from 'react-native-share';
import Setting from '@joplin/lib/models/Setting';
import NoteExportButton from './NoteExportButton';
jest.mock('react-native-share', () => {
const Share = {
open: (_options: ShareOptions) => jest.fn(),
};
return Share;
});
describe('NoteExportButton', () => {
beforeEach(async () => {
await setupDatabaseAndSynchronizer(1);
await switchClient(1);
const folder1 = await Folder.save({ title: 'folder1' });
await createNTestNotes(10, folder1);
const folder2 = await Folder.save({ title: 'Folder 2 🙂' });
await createNTestNotes(10, folder2);
});
test('should show "Exported successfully!" after clicking "Export"', async () => {
const styles = configScreenStyles(Setting.THEME_DARK);
const view = render(<NoteExportButton
styles={styles}
/>);
const exportButton = view.getByText(_('Export all notes as JEX'));
await act(() => fireEvent.press(exportButton));
await waitFor(() =>
expect(view.queryByText(_('Exported successfully!'))).not.toBeNull(),
);
// With the default folder setup, there should be no warnings
expect(view.queryByText(/Warnings/g)).toBeNull();
view.unmount();
});
});