aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/src/files_views/trashbinView.spec.ts
blob: 7f5a45ee9cd68e037407fc788f8a2d9ce9d70c75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
 * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
import { describe, expect, it } from 'vitest'
import isSvg from 'is-svg'

import { deleted, deletedBy, originalLocation } from './columns'
import { TRASHBIN_VIEW_ID, trashbinView } from './trashbinView.ts'
import { getContents } from '../services/trashbin.ts'

describe('files_trasbin: trashbin files view', () => {
	it('has correct strings', () => {
		expect(trashbinView.id).toBe(TRASHBIN_VIEW_ID)
		expect(trashbinView.name).toBe('Deleted files')
		expect(trashbinView.caption).toBe('List of files that have been deleted.')
		expect(trashbinView.emptyTitle).toBe('No deleted files')
		expect(trashbinView.emptyCaption).toBe('Files and folders you have deleted will show up here')
	})

	it('sorts by deleted time', () => {
		expect(trashbinView.defaultSortKey).toBe('deleted')
	})

	it('is sticky to the bottom in the view list', () => {
		expect(trashbinView.sticky).toBe(true)
	})

	it('has order defined', () => {
		expect(trashbinView.order).toBeTypeOf('number')
		expect(trashbinView.order).toBe(50)
	})

	it('has valid icon', () => {
		expect(trashbinView.icon).toBeTypeOf('string')
		expect(isSvg(trashbinView.icon)).toBe(true)
	})

	it('has custom columns', () => {
		expect(trashbinView.columns).toHaveLength(3)
		expect(trashbinView.columns).toEqual([
			originalLocation,
			deletedBy,
			deleted,
		])
	})

	it('has get content method', () => {
		expect(trashbinView.getContents).toBeTypeOf('function')
		expect(trashbinView.getContents).toBe(getContents)
	})
})