feat: ValueMatcher 支持 primitive 原始值简写,等价于 { equals: value }
This commit is contained in:
@@ -48,19 +48,19 @@ describe("validatePingConfig", () => {
|
||||
expect(issues.some((item) => item.path.endsWith("expect.maxPacketLoss"))).toBe(true);
|
||||
});
|
||||
|
||||
test("durationMs 类型非法", () => {
|
||||
const issues = validate({ expect: { durationMs: -1 }, id: "ping", ping: { host: "127.0.0.1" }, type: "ping" });
|
||||
test("durationMs 数组简写非法", () => {
|
||||
const issues = validate({ expect: { durationMs: [1, 2] }, id: "ping", ping: { host: "127.0.0.1" }, type: "ping" });
|
||||
expect(issues.some((item) => item.path.endsWith("expect.durationMs"))).toBe(true);
|
||||
});
|
||||
|
||||
test("avgLatencyMs 类型非法", () => {
|
||||
test("avgLatencyMs 对象简写非法", () => {
|
||||
const issues = validate({
|
||||
expect: { avgLatencyMs: "slow" },
|
||||
expect: { avgLatencyMs: { foo: "bar" } },
|
||||
id: "ping",
|
||||
ping: { host: "127.0.0.1" },
|
||||
type: "ping",
|
||||
});
|
||||
expect(issues.some((item) => item.path.endsWith("expect.avgLatencyMs"))).toBe(true);
|
||||
expect(issues.some((item) => item.path.endsWith("expect.avgLatencyMs.foo"))).toBe(true);
|
||||
});
|
||||
|
||||
test("host 为空字符串", () => {
|
||||
|
||||
Reference in New Issue
Block a user