test
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Viewing readonly version of main branch: v18View latest version
A test utility and badge to put in your val readme to show test suite status
Example:
Usage:
- Make a val
- Make a separate test suite HTTP file for the val you want to test
- Import
describe
andit
utilities - Write tests
- Add the badge to your readme, with the
url
parameter pointing to the test suite file's endpoint. Tests run whenever the test suite file 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://testme.val.run?url=YOUR_TEST_SUITE_ENDPOINT
[url]: YOUR_TEST_SUITE_URL
Example
[![][badge]][url]
[badge]: https://testme.val.run?url=https://tuna-test.val.run
[url]: https://www.val.town/x/jxnblk/test/code/example.http.tsx