Skip to content

Commit a8a4116

Browse files
committed
优化测试
1 parent 90e8f65 commit a8a4116

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

test/post-put-delete.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { test } from "vitest";
55
import { fetch } from "undici";
66
test("post-ok-index2-file", async () => {
77
const path = fileURLToPath(new URL("../index/", import.meta.url));
8-
const port = Math.floor(Math.random() * 65536);
8+
const port = 20000 + Math.floor(Math.random() * 45536);
99
const host = "127.0.0.1";
1010
const username = "root";
1111
const password = "root";
@@ -41,7 +41,7 @@ test("post-ok-index2-file", async () => {
4141
});
4242
test("put-ok-index2-file", async () => {
4343
const path = fileURLToPath(new URL("../index/", import.meta.url));
44-
const port = Math.floor(Math.random() * 65536);
44+
const port = 20000 + Math.floor(Math.random() * 45536);
4545
const host = "127.0.0.1";
4646
const username = "root";
4747
const password = "root";
@@ -80,7 +80,7 @@ test("put-ok-index2-file", async () => {
8080

8181
test("delete-ok-index2-file", async () => {
8282
const path = fileURLToPath(new URL("../index/", import.meta.url));
83-
const port = Math.floor(Math.random() * 65536);
83+
const port = 20000 + Math.floor(Math.random() * 45536);
8484
const host = "127.0.0.1";
8585
const username = "root";
8686
const password = "root";

test/profind.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { fetch } from "undici";
66

77
test("propfind-ok-depth-0-disableAuthentication", async () => {
88
const path = fileURLToPath(new URL("../index/", import.meta.url));
9-
const port = Math.floor(Math.random() * 65536);
9+
const port = 20000 + Math.floor(Math.random() * 45536);
1010
const host = "127.0.0.1";
1111
const username = "root";
1212
const password = "root";
@@ -38,7 +38,7 @@ test("propfind-ok-depth-0-disableAuthentication", async () => {
3838
});
3939
test("propfind-Unauthorized", async () => {
4040
const path = fileURLToPath(new URL("../index/", import.meta.url));
41-
const port = Math.floor(Math.random() * 65536);
41+
const port = 20000 + Math.floor(Math.random() * 45536);
4242
const host = "127.0.0.1";
4343
const username = "root";
4444
const password = "root";
@@ -60,7 +60,7 @@ test("propfind-Unauthorized", async () => {
6060
});
6161
test("propfind-Forbidden-no-depth", async () => {
6262
const path = fileURLToPath(new URL("../index/", import.meta.url));
63-
const port = Math.floor(Math.random() * 65536);
63+
const port = 20000 + Math.floor(Math.random() * 45536);
6464
const host = "127.0.0.1";
6565
const username = "root";
6666
const password = "root";
@@ -84,7 +84,7 @@ test("propfind-Forbidden-no-depth", async () => {
8484
});
8585
test("propfind-Forbidden-depth-2", async () => {
8686
const path = fileURLToPath(new URL("../index/", import.meta.url));
87-
const port = Math.floor(Math.random() * 65536);
87+
const port = 20000 + Math.floor(Math.random() * 45536);
8888
const host = "127.0.0.1";
8989
const username = "root";
9090
const password = "root";
@@ -109,7 +109,7 @@ test("propfind-Forbidden-depth-2", async () => {
109109
});
110110
test("propfind-ok-depth-0", async () => {
111111
const path = fileURLToPath(new URL("../index/", import.meta.url));
112-
const port = Math.floor(Math.random() * 65536);
112+
const port = 20000 + Math.floor(Math.random() * 45536);
113113
const host = "127.0.0.1";
114114
const username = "root";
115115
const password = "root";
@@ -134,7 +134,7 @@ test("propfind-ok-depth-0", async () => {
134134
});
135135
test("propfind-ok-depth-1", async () => {
136136
const path = fileURLToPath(new URL("../index/", import.meta.url));
137-
const port = Math.floor(Math.random() * 65536);
137+
const port = 20000 + Math.floor(Math.random() * 45536);
138138
const host = "127.0.0.1";
139139
const username = "root";
140140
const password = "root";
@@ -159,7 +159,7 @@ test("propfind-ok-depth-1", async () => {
159159
});
160160
test("propfind-ok-depth-1-methodsWithoutAuthentication", async () => {
161161
const path = fileURLToPath(new URL("../index/", import.meta.url));
162-
const port = Math.floor(Math.random() * 65536);
162+
const port = 20000 + Math.floor(Math.random() * 45536);
163163
const host = "127.0.0.1";
164164
const username = "root";
165165
const password = "root";

test/test.test.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { fetch } from "undici";
66

77
test("DELETE-fail-index-file-disableAuthentication", async () => {
88
const path = fileURLToPath(new URL("../index/", import.meta.url));
9-
const port = Math.floor(Math.random() * 65536);
9+
const port = 20000 + Math.floor(Math.random() * 45536);
1010
const host = "127.0.0.1";
1111
const username = "root";
1212
const password = "root";
@@ -36,7 +36,7 @@ test("DELETE-fail-index-file-disableAuthentication", async () => {
3636
});
3737
test("post-fail-index-file-disableAuthentication", async () => {
3838
const path = fileURLToPath(new URL("../index/", import.meta.url));
39-
const port = Math.floor(Math.random() * 65536);
39+
const port = 20000 + Math.floor(Math.random() * 45536);
4040
const host = "127.0.0.1";
4141
const username = "root";
4242
const password = "root";
@@ -66,7 +66,7 @@ test("post-fail-index-file-disableAuthentication", async () => {
6666
});
6767
test("get-ok-index-file-disableAuthentication", async () => {
6868
const path = fileURLToPath(new URL("../index/", import.meta.url));
69-
const port = Math.floor(Math.random() * 65536);
69+
const port = 20000 + Math.floor(Math.random() * 45536);
7070
const host = "127.0.0.1";
7171
const username = "root";
7272
const password = "root";
@@ -101,7 +101,7 @@ test("get-ok-index-file-disableAuthentication", async () => {
101101

102102
test("get-Unauthorized", async () => {
103103
const path = fileURLToPath(new URL("../index/", import.meta.url));
104-
const port = Math.floor(Math.random() * 65536);
104+
const port = 20000 + Math.floor(Math.random() * 45536);
105105
const host = "127.0.0.1";
106106
const username = "root";
107107
const password = "root";
@@ -123,7 +123,7 @@ test("get-Unauthorized", async () => {
123123

124124
test("get-ok-dir-index", async () => {
125125
const path = fileURLToPath(new URL("../index/", import.meta.url));
126-
const port = Math.floor(Math.random() * 65536);
126+
const port = 20000 + Math.floor(Math.random() * 45536);
127127
const host = "127.0.0.1";
128128
const username = "root";
129129
const password = "root";
@@ -150,7 +150,7 @@ test("get-ok-dir-index", async () => {
150150
});
151151
test("get-ok-index-file", async () => {
152152
const path = fileURLToPath(new URL("../index/", import.meta.url));
153-
const port = Math.floor(Math.random() * 65536);
153+
const port = 20000 + Math.floor(Math.random() * 45536);
154154
const host = "127.0.0.1";
155155
const username = "root";
156156
const password = "root";
@@ -176,7 +176,7 @@ test("get-ok-index-file", async () => {
176176
});
177177
test("get-ok-index-file-methodsWithoutAuthentication", async () => {
178178
const path = fileURLToPath(new URL("../index/", import.meta.url));
179-
const port = Math.floor(Math.random() * 65536);
179+
const port = 20000 + Math.floor(Math.random() * 45536);
180180
const host = "127.0.0.1";
181181
const username = "root";
182182
const password = "root";
@@ -210,7 +210,7 @@ test("get-ok-index-file-methodsWithoutAuthentication", async () => {
210210
});
211211
test("get-not-found-index-file", async () => {
212212
const path = fileURLToPath(new URL("../index/", import.meta.url));
213-
const port = Math.floor(Math.random() * 65536);
213+
const port = 20000 + Math.floor(Math.random() * 45536);
214214
const host = "127.0.0.1";
215215
const username = "root";
216216
const password = "root";

0 commit comments

Comments
 (0)