gitea/web_src/js/modules/diff-file.test.ts
Kerwin Bryant 2b76993415
support the open-icon of folder (#34168)
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-04-28 19:51:32 -07:00

52 lines
1.4 KiB
TypeScript

import {diffTreeStoreSetViewed, reactiveDiffTreeStore} from './diff-file.ts';
test('diff-tree', () => {
const store = reactiveDiffTreeStore({
'TreeRoot': {
'FullName': '',
'DisplayName': '',
'EntryMode': '',
'IsViewed': false,
'NameHash': '....',
'DiffStatus': '',
'FileIcon': '',
'Children': [
{
'FullName': 'dir1',
'DisplayName': 'dir1',
'EntryMode': 'tree',
'IsViewed': false,
'NameHash': '....',
'DiffStatus': '',
'FileIcon': '',
'Children': [
{
'FullName': 'dir1/test.txt',
'DisplayName': 'test.txt',
'DiffStatus': 'added',
'NameHash': '....',
'EntryMode': '',
'IsViewed': false,
'FileIcon': '',
'Children': null,
},
],
},
{
'FullName': 'other.txt',
'DisplayName': 'other.txt',
'NameHash': '........',
'DiffStatus': 'added',
'EntryMode': '',
'IsViewed': false,
'FileIcon': '',
'Children': null,
},
],
},
}, '', '');
diffTreeStoreSetViewed(store, 'dir1/test.txt', true);
expect(store.fullNameMap['dir1/test.txt'].IsViewed).toBe(true);
expect(store.fullNameMap['dir1'].IsViewed).toBe(true);
});