Skip to content

Commit bf546ce

Browse files
luozhang002binghaiwang
authored andcommitted
Clean browser test bucket (#487)
* fix: clean object in browser test case * fix: remove console.log in browser.test.js
1 parent 304bdbb commit bf546ce

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/browser/browser.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,26 @@ const co = require('co');
2424

2525
timemachine.reset();
2626

27+
let cleanBucket = function* (store) {
28+
let result = yield store.list({
29+
'max-keys': 1000,
30+
});
31+
result.objects = result.objects || [];
32+
for (let i = 0; i < result.objects.length; i++) {
33+
const obj = result.objects[i];
34+
yield store.delete(obj.name);
35+
}
36+
37+
result = yield store.listUploads({
38+
'max-uploads': 1000,
39+
});
40+
const uploads = result.uploads || [];
41+
for (let i = 0; i < uploads.length; i++) {
42+
const up = uploads[i];
43+
yield store.abortMultipartUpload(up.name, up.uploadId);
44+
}
45+
}
46+
2747
describe('browser', () => {
2848
/* eslint require-yield: [0] */
2949
before(function* () {
@@ -43,6 +63,10 @@ describe('browser', () => {
4363
// bucket: stsConfig.bucket
4464
// });
4565
});
66+
after(function* () {
67+
this.store = oss(ossConfig);
68+
yield cleanBucket(this.store);
69+
});
4670
describe('endpoint', () => {
4771
it('should init with region', () => {
4872
let store = oss({

0 commit comments

Comments
 (0)