Skip to content

Commit f419e84

Browse files
committed
fixup! Add stall detection to recover from frozen uploads
1 parent c0fd245 commit f419e84

File tree

1 file changed

+1
-94
lines changed

1 file changed

+1
-94
lines changed

test/spec/test-stall-detection.js

Lines changed: 1 addition & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -42,98 +42,7 @@ function getBodySize(body) {
4242
}
4343

4444
describe('tus-stall-detection', () => {
45-
describe('configuration options', () => {
46-
it('should have stall detection disabled by default', () => {
47-
const testStack = new TestHttpStack()
48-
const file = getBlob('hello world')
49-
50-
const options = {
51-
httpStack: testStack,
52-
endpoint: 'https://tus.io/uploads',
53-
}
54-
55-
const upload = new Upload(file, options)
56-
57-
// Verify stall detection is disabled by default
58-
expect(upload.options.stallDetection.enabled).toBe(false)
59-
expect(upload.options.stallDetection.stallTimeout).toBe(30000)
60-
expect(upload.options.stallDetection.checkInterval).toBe(5000)
61-
62-
// Abort to clean up
63-
upload.abort()
64-
})
65-
66-
it('should apply default stall detection options when enabled', () => {
67-
const testStack = new TestHttpStack()
68-
const file = getBlob('hello world')
69-
70-
const options = {
71-
httpStack: testStack,
72-
endpoint: 'https://tus.io/uploads',
73-
stallDetection: {
74-
enabled: true,
75-
},
76-
}
77-
78-
const upload = new Upload(file, options)
79-
80-
// Verify stall detection is enabled with default values
81-
expect(upload.options.stallDetection.enabled).toBe(true)
82-
expect(upload.options.stallDetection.stallTimeout).toBe(30000)
83-
expect(upload.options.stallDetection.checkInterval).toBe(5000)
84-
85-
// Abort to clean up
86-
upload.abort()
87-
})
88-
89-
it('should apply custom stall detection options', () => {
90-
const testStack = new TestHttpStack()
91-
const file = getBlob('hello world')
92-
93-
const customOptions = {
94-
enabled: true,
95-
stallTimeout: 15000,
96-
checkInterval: 2500,
97-
}
98-
99-
const options = {
100-
httpStack: testStack,
101-
endpoint: 'https://tus.io/uploads',
102-
stallDetection: customOptions,
103-
}
104-
105-
const upload = new Upload(file, options)
106-
107-
// Verify the custom options were applied
108-
expect(upload.options.stallDetection.enabled).toBe(true)
109-
expect(upload.options.stallDetection.stallTimeout).toBe(15000)
110-
expect(upload.options.stallDetection.checkInterval).toBe(2500)
111-
112-
// Abort to clean up
113-
upload.abort()
114-
})
115-
116-
it('should disable stall detection when configured', () => {
117-
const testStack = new TestHttpStack()
118-
const file = getBlob('hello world')
119-
120-
const options = {
121-
httpStack: testStack,
122-
endpoint: 'https://tus.io/uploads',
123-
stallDetection: {
124-
enabled: false,
125-
},
126-
}
127-
128-
const upload = new Upload(file, options)
129-
130-
// Verify stall detection is disabled
131-
expect(upload.options.stallDetection.enabled).toBe(false)
132-
133-
// Abort to clean up
134-
upload.abort()
135-
})
136-
45+
describe('integration tests', () => {
13746
it("should not enable stall detection if HTTP stack doesn't support progress events", async () => {
13847
// Enable debug logging temporarily
13948
const { enableDebugLog } = await import('tus-js-client')
@@ -190,9 +99,7 @@ describe('tus-stall-detection', () => {
19099
// Abort to clean up
191100
upload.abort()
192101
})
193-
})
194102

195-
describe('integration tests', () => {
196103
it('should upload a file with stall detection enabled', async () => {
197104
const testStack = new TestHttpStack()
198105
// Mock the stack to support progress events

0 commit comments

Comments
 (0)