-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathFilesConfig.test.ts
More file actions
59 lines (47 loc) · 1.67 KB
/
FilesConfig.test.ts
File metadata and controls
59 lines (47 loc) · 1.67 KB
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
53
54
55
56
57
58
59
import { FilesConfig } from '../../../src/files'
describe('FilesConfig', () => {
beforeEach(() => {
// Reset config before each test
FilesConfig.init({})
})
describe('init', () => {
test('should set useS3Tagging configuration', () => {
FilesConfig.init({ useS3Tagging: false })
const config = FilesConfig.getConfig()
expect(config.useS3Tagging).toBe(false)
})
test('should set maxMultipartRetries configuration', () => {
FilesConfig.init({ maxMultipartRetries: 10 })
const config = FilesConfig.getConfig()
expect(config.maxMultipartRetries).toBe(10)
})
test('should set fileUploadTimeoutMs configuration', () => {
FilesConfig.init({ fileUploadTimeoutMs: 120000 })
const config = FilesConfig.getConfig()
expect(config.fileUploadTimeoutMs).toBe(120000)
})
test('should set multiple configuration options', () => {
FilesConfig.init({
useS3Tagging: false,
maxMultipartRetries: 3,
fileUploadTimeoutMs: 30000
})
const config = FilesConfig.getConfig()
expect(config.useS3Tagging).toBe(false)
expect(config.maxMultipartRetries).toBe(3)
expect(config.fileUploadTimeoutMs).toBe(30000)
})
})
describe('getConfig', () => {
test('should return empty config by default', () => {
const config = FilesConfig.getConfig()
expect(config).toEqual({})
})
test('should return previously set config', () => {
const expectedConfig = { useS3Tagging: true, maxMultipartRetries: 5 }
FilesConfig.init(expectedConfig)
const config = FilesConfig.getConfig()
expect(config).toEqual(expectedConfig)
})
})
})