Skip to content

Commit 6239026

Browse files
committed
Have every test clean itself up.
1 parent bc5bcee commit 6239026

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

test/e2e/copy.spec.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ const workerUrl = process.env.WORKER_URL;
66
const ORG = 'da-e2e-test';
77

88
describe('/copy operation', () => {
9-
it('copies a file', async () => {
9+
it('copies a file', async function() {
10+
this.timeout(60000);
11+
1012
const blob = new Blob(['Hello World!'], { type: "text/html" });
1113
let body = new FormData();
1214
body.append('data', blob);
@@ -35,9 +37,16 @@ describe('/copy operation', () => {
3537
assert.strictEqual(resp.status, 200);
3638
const content = await resp.text();
3739
assert.strictEqual(content, 'Hello World!');
40+
41+
resp = await fetch(`${workerUrl}/source/${ORG}/copy-spec/test-file.html`, { method: 'DELETE' });
42+
assert.strictEqual(resp.status, 204);
43+
44+
resp = await fetch(`${workerUrl}/source/${ORG}/copy-spec/test-file-copy.html`, { method: 'DELETE' });
45+
assert.strictEqual(resp.status, 204);
3846
});
3947

40-
it('copies a folder', async () => {
48+
it('copies a folder', async function() {
49+
this.timeout(60000);
4150
const limit = 5;
4251
for (let i = 0; i < limit; i++) {
4352
const blob = new Blob(['Hello World!'], { type: "text/html" });
@@ -65,6 +74,11 @@ describe('/copy operation', () => {
6574
assert.strictEqual(resp.status, 200);
6675
resp = await fetch(`${workerUrl}/source/${ORG}/copy-spec/test-folder-copy/index${i}.html`);
6776
assert.strictEqual(resp.status, 200);
77+
78+
resp = await fetch(`${workerUrl}/source/${ORG}/copy-spec/test-folder/index${i}.html`, { method: 'DELETE' });
79+
assert.strictEqual(resp.status, 204);
80+
resp = await fetch(`${workerUrl}/source/${ORG}/copy-spec/test-folder-copy/index${i}.html`, { method: 'DELETE' });
81+
assert.strictEqual(resp.status, 204);
6882
}
6983
});
7084
});

test/e2e/list.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@ describe('/list requests', () => {
2929
assert.strictEqual(resp.status, 200);
3030
const json = await resp.json();
3131
assert(json.some(org => org.path === `/${ORG}/list-spec/test-file.html`));
32+
33+
resp = await fetch(`${workerUrl}/source/${ORG}/list-spec/test-file.html`, { method: 'DELETE' });
34+
assert.strictEqual(resp.status, 204);
3235
});
3336
});

test/e2e/move.spec.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const workerUrl = process.env.WORKER_URL;
44
const ORG = 'da-e2e-test';
55

66
describe('/move operation', () => {
7-
it('moves a file', async () => {
7+
it('moves a file', async function() {
8+
this.timeout(60000);
89
const label = 'move-spec-label';
910
const blob = new Blob(['Hello World!'], { type: "text/html" });
1011
let body = new FormData();
@@ -46,9 +47,13 @@ describe('/move operation', () => {
4647
resp = await fetch(`${workerUrl}/versionlist/${ORG}/move-spec/test-file-moved.html`);
4748
const json = await resp.json();
4849
assert(json.some((ver) => ver.label === label));
50+
51+
resp = await fetch(`${workerUrl}/source/${ORG}/move-spec/test-file-moved.html`, { method: 'DELETE' });
52+
assert.strictEqual(resp.status, 204);
4953
});
5054

51-
it('moves a folder', async () => {
55+
it('moves a folder', async function () {
56+
this.timeout(60000);
5257
const limit = 1;
5358
for (let i = 0; i < limit; i++) {
5459
const blob = new Blob(['Hello World!'], { type: "text/html" });
@@ -76,6 +81,8 @@ describe('/move operation', () => {
7681
assert.strictEqual(resp.status, 404);
7782
resp = await fetch(`${workerUrl}/source/${ORG}/move-spec/test-folder-moved/index${i}.html`);
7883
assert.strictEqual(resp.status, 200);
84+
resp = await fetch(`${workerUrl}/source/${ORG}/move-spec/test-folder-moved/index${i}.html`, { method: 'DELETE' });
85+
assert.strictEqual(resp.status, 204);
7986
}
8087
});
8188
});

test/e2e/version.spec.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,8 @@ describe('/version* operations', () => {
6060
const currentContent = await resp.text();
6161
assert.strictEqual(currentContent, 'Changed Body!');
6262
assert.notStrictEqual(labeledContent, currentContent);
63+
64+
resp = await fetch(`${workerUrl}/source/${ORG}/version-spec/test-file.html`, { method: 'DELETE' });
65+
assert.strictEqual(resp.status, 204);
6366
});
6467
});

0 commit comments

Comments
 (0)