5It is extracted into a val to avoid having all that clutter in the same val as your tests.
6
7Each test is a named function (which can be async), the name is used as the name for the test.
8- the input passed as the first argument is passed to each test, great for importing assertion methods, stubs, fixed values, ... everything that you do not mutate during a test
9- if a function is async (it returns a promise) there is a timeout of 2 seconds before the test is marked as failed.
10- all tests are called in the declared order, but async tests run in parallel afterwards, so don't assume any order
11- if a test starts with `skip` it is not executed
13- if all tests pass it returns the output, so it appears in the grey box and the evaluation/run is marked green.
14
15Note: If you are using the test runner to store the result in that val, as described above, it is considered a "JSON val" and has a run button, but it also means that another of your vals could update the val with just any other (JSON) state. Alternatively you can define a function val that calls the test runner and have a separete val to keep the curretn test results, but it means after updating the tests you need to fest save that val and then reevaluate to val storing the test state.
16
17Migrated from folder: testing/testRunner
1# This Val URL
2
3Returns the URL of the val that calls this function.
4
5See https://www.val.town/v/neverstew.thisValUrlExample
1# `computeSchedule` function
2Combines several schedule segments together to form a complete schedule for a 24-hour period.
3
1# `computeScheduleSegment` function
2Calculates the on/off time spans for a given schedule segment based on the duty cycle.
3
1# `timeSpanUnion` function
2Combines overlapping time spans into single time spans.
3
1# 'isInTimeSpan` function
2Checks if provided time is within the timeframe of the provided time span.
3
8
90. [Log in to Val Town](val.town/auth/signin)
101. [Fork this Val](https://www.val.town/new?code=function+forwardEmail%28e%3A+%7B%0A++from%3A+string%3B%0A++to%3A+string%5B%5D%3B%0A++subject%3A+string%3B%0A++text%3A+string%3B%0A++html%3A+string%3B%0A%7D%29+%7B%0A++console.email%28%7B+html%3A+e.html%2C+subject%3A+e.subject+%7D%29%3B%0A%7D%0A%2F%2F+Forked+from+%40maas.forwardEmail)
111. Publish the Val via **🔒 > Unlisted**
121. Copy the email endpoint via **â‹® > Endpoints > Copy email address**
2Gets information about a specific val.
3
4To access private vals, pass your API token as a secret to the function. Read more about [authentication](https://docs.val.town/api/authentication) to understand how to generate a token and save it as a secret.
5
6Migrated from folder: docs/api/getVal
3Query anything with SQL! Your data is stored in the `data` table.
4
5See the [DuckDB documentation](https://duckdb.org/docs/sql/introduction) for possible functions etc.
6
7Migrated from folder: duckdb/query
9## Authentication
10
11This function requires two keys: one from Github to get your gists, and one from Val Town to make the vals in your account:
12
131. Github token: https://github.com/settings/tokens
16## Usage
17
18You can use this function by calling it and passing your keys like so:
19
20```
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",