一些检查失败了
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
34 行
964 B
TypeScript
34 行
964 B
TypeScript
import FolderRecord from './FolderRecord';
|
|
import Folder from '@joplin/lib/models/Folder';
|
|
import { afterAllCleanUp, afterEachCleanUp, setupDatabase } from '@joplin/lib/testing/test-utils';
|
|
import * as sqlite3 from 'sqlite3';
|
|
import { shimInit } from '@joplin/lib/shim-init-node';
|
|
|
|
describe('FolderRecord', () => {
|
|
beforeAll(() => {
|
|
shimInit({ nodeSqlite: sqlite3 });
|
|
});
|
|
afterAll(afterAllCleanUp);
|
|
afterEach(afterEachCleanUp);
|
|
|
|
beforeEach(async () => {
|
|
await setupDatabase();
|
|
});
|
|
|
|
it('should remove leading /s from titles for consistency with the Folder model', async () => {
|
|
const record = new FolderRecord({
|
|
title: '//test',
|
|
id: '1234567890abcdef1234567890abcdef',
|
|
parentId: '',
|
|
childIds: [],
|
|
isShared: false,
|
|
sharedWith: [],
|
|
ownedByEmail: '',
|
|
});
|
|
|
|
const folder = await Folder.save({ title: '//test' }, { userSideValidation: true });
|
|
expect(record.title).toBe('test');
|
|
expect(record.title).toBe(folder.title);
|
|
});
|
|
});
|