Skip to content

Commit

Permalink
fix: descriptive name for test from checks lib (#138)
Browse files Browse the repository at this point in the history
fixes winglang/wing#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)
  • Loading branch information
itssubhodiproy authored Mar 26, 2024
1 parent b064dfa commit 1afd979
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions checks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
7 changes: 6 additions & 1 deletion checks/check.test.w
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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();
Expand Down Expand Up @@ -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}");
}
2 changes: 1 addition & 1 deletion checks/check.w
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 1afd979

Please sign in to comment.