Public
HTTP (deprecated)
Readme

A test utility and badge to put in your val readme to show test suite status

Example:

Usage:

  1. Make a val
  2. Make a separate test suite HTTP val for the val you want to test
  3. Import describe and it utilities
  4. Write tests
  5. Add the badge to your readme, with the url parameter pointing to the test suite val's endpoint. Tests run whenever the test suite val or the badge is fetched
import { describe, it } from "https://esm.town/v/jxnblk/test"; import { assertEquals } from "jsr:@std/assert@1"; export default describe("my test suite", () => { const sum = (a, b) => a + b; it("sums it up", () => { assertEquals(sum(1, 2), 3); }) })

Badge:

[![][badge]][url] [badge]: https://jxnblk-test.web.val.run?url=YOUR_TEST_SUITE_ENDPOINT [url]: YOUR_TEST_SUITE_URL

Example

[![][badge]][url] [badge]: https://jxnblk-test.web.val.run?url=https://jxnblk-tunatestsuite.web.val.run [url]: https://www.val.town/v/jxnblk/tunaTestSuite
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
jxnblk-test.web.val.run
August 23, 2024