Skip to content

Commit aab4a4b

Browse files
committed
Fix test
1 parent 27a209d commit aab4a4b

File tree

1 file changed

+13
-39
lines changed

1 file changed

+13
-39
lines changed

library/agent/ServiceConfig.test.ts

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import * as t from "tap";
2-
import { Endpoints } from "./Endpoints";
32
import { ServiceConfig } from "./ServiceConfig";
43

54
t.test("it returns false if empty rules", async () => {
65
const config = new ServiceConfig([], 0, [], []);
76
t.same(config.getLastUpdatedAt(), 0);
87
t.same(config.isUserBlocked("id"), false);
98
t.same(config.isAllowedIP("1.2.3.4"), false);
10-
t.same(config.getEndpoints(), new Endpoints([]));
9+
t.same(
10+
config.getEndpoint({ url: undefined, method: undefined, route: undefined }),
11+
undefined
12+
);
1113
});
1214

1315
t.test("it works", async () => {
@@ -51,53 +53,25 @@ t.test("it works", async () => {
5153

5254
t.same(config.isUserBlocked("123"), true);
5355
t.same(config.isUserBlocked("567"), false);
54-
});
55-
56-
t.test("it returns endpoints", async () => {
57-
const config = new ServiceConfig(
58-
[
59-
{
60-
method: "GET",
61-
route: "/foo",
62-
forceProtectionOff: false,
63-
rateLimiting: { enabled: true, maxRequests: 10, windowSizeInMS: 1000 },
64-
},
65-
{
66-
method: "POST",
67-
route: "/foo",
68-
forceProtectionOff: true,
69-
rateLimiting: {
70-
enabled: false,
71-
maxRequests: 0,
72-
windowSizeInMS: 0,
73-
},
74-
},
75-
],
76-
0,
77-
[],
78-
[]
79-
);
80-
8156
t.same(
82-
config.getEndpoints(),
83-
new Endpoints([
84-
{
57+
config.getEndpoint({
58+
url: undefined,
59+
method: "GET",
60+
route: "/foo",
61+
}),
62+
{
63+
endpoint: {
8564
method: "GET",
8665
route: "/foo",
8766
forceProtectionOff: false,
88-
rateLimiting: { enabled: true, maxRequests: 10, windowSizeInMS: 1000 },
89-
},
90-
{
91-
method: "POST",
92-
route: "/foo",
93-
forceProtectionOff: true,
9467
rateLimiting: {
9568
enabled: false,
9669
maxRequests: 0,
9770
windowSizeInMS: 0,
9871
},
9972
},
100-
])
73+
route: "/foo",
74+
}
10175
);
10276
});
10377

0 commit comments

Comments
 (0)