From 1afd979df3236199685fa6ee8b904a8d8576ae34 Mon Sep 17 00:00:00 2001 From: Subhodip Roy <75121304+subh-cs@users.noreply.github.com> Date: Tue, 26 Mar 2024 14:52:19 +0530 Subject: [PATCH] fix: descriptive name for test from checks lib (#138) fixes https://github.com/winglang/wing/issues/5109 for this code ```js bring checks; new checks.Check(inflight () => {}) as "one"; new checks.Check(inflight () => {}) as "two"; test "test name example" {} ``` now it look like this ![image](https://github.com/winglang/winglibs/assets/75121304/4c3cebba-716a-4f68-bf26-00350f5f6ecf) --- checks/README.md | 4 ++++ checks/check.test.w | 7 ++++++- checks/check.w | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/checks/README.md b/checks/README.md index 5ab9caa2..c6acdebf 100644 --- a/checks/README.md +++ b/checks/README.md @@ -143,6 +143,10 @@ let allResults = resultsBucket.list(); - [ ] REST API for querying/executing checks - [ ] Console UI +## Maintainers +- [Elad Ben-Israel](https://github.com/eladb) +- [Subhodip Roy](https://github.com/subh-cs) + ## License Licensed under the [MIT License](./LICENSE). \ No newline at end of file diff --git a/checks/check.test.w b/checks/check.test.w index 27b0d390..221930a8 100644 --- a/checks/check.test.w +++ b/checks/check.test.w @@ -3,6 +3,7 @@ bring http; bring cloud; bring expect; +let checkName = "Test"; let api = new cloud.Api(); let s = new cloud.Bucket() as "customize"; let responseKey = "response.json"; @@ -27,7 +28,7 @@ let check = new c.Check(inflight () => { log(response.body); expect.equal(response.body, "/foo"); // body is expected to be the path -}, deploy: false); +}, deploy: false) as checkName; test "run() with success" { let result = check.run(); @@ -55,4 +56,8 @@ test "run() with failure" { assert(!result.ok); expect.equal(result.error, "response status 404"); expect.equal(check.latest()?.ok, false); +} + +test "check name is set" { + expect.equal("check {check.node.id}", "check {checkName}"); } \ No newline at end of file diff --git a/checks/check.w b/checks/check.w index 62b46298..59bdb659 100644 --- a/checks/check.w +++ b/checks/check.w @@ -78,7 +78,7 @@ pub class Check impl ICheck { } if props?.testing ?? true { - new std.Test(handler) as "test"; + new std.Test(handler) as "check {this.node.id}"; } this.invoker = new cloud.Function(wrapper) as "run";