一些检查失败了
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
45 行
1.4 KiB
TypeScript
45 行
1.4 KiB
TypeScript
import { setupDatabaseAndSynchronizer, switchClient } from './testing/test-utils';
|
|
import WelcomeUtils, { WelcomeAssetPlatform } from './WelcomeUtils';
|
|
import Folder from './models/Folder';
|
|
import { FolderIconType } from './services/database/types';
|
|
import Note from './models/Note';
|
|
|
|
describe('WelcomeUtils', () => {
|
|
|
|
beforeEach(async () => {
|
|
await setupDatabaseAndSynchronizer(1);
|
|
await switchClient(1);
|
|
});
|
|
|
|
it('should create welcome items with waving hand emoji icon for the folder', async () => {
|
|
const result = await WelcomeUtils.createWelcomeItems('en_GB', WelcomeAssetPlatform.Desktop);
|
|
|
|
expect(result.defaultFolderId).toBeTruthy();
|
|
|
|
const folder = await Folder.load(result.defaultFolderId);
|
|
expect(folder).toBeTruthy();
|
|
|
|
const icon = Folder.unserializeIcon(folder.icon);
|
|
expect(icon.type).toBe(FolderIconType.Emoji);
|
|
expect(icon.emoji).toBe('👋');
|
|
});
|
|
|
|
|
|
it.each([
|
|
WelcomeAssetPlatform.Web, WelcomeAssetPlatform.Desktop,
|
|
])('should create web welcome notes only on web (testing platform: %s)', async (platform) => {
|
|
const result = await WelcomeUtils.createWelcomeItems('en_GB', platform);
|
|
|
|
const notes = await Note.previews(result.defaultFolderId);
|
|
|
|
const webAppNoteTitle = '0. About the web app';
|
|
const noteTitles = notes.map(note => note.title);
|
|
|
|
if (platform === WelcomeAssetPlatform.Web) {
|
|
expect(noteTitles).toContain(webAppNoteTitle);
|
|
} else {
|
|
expect(noteTitles).not.toContain(webAppNoteTitle);
|
|
}
|
|
});
|
|
});
|