Public
Back
Version 1
3/30/2023
export async function testSemantics() {
const stateName = "@stevekrouse.testState";
const last = await stevekrouse.fetchJSON(
`https://api.val.town/eval/${stateName}`
).data;
const now = Date.now();
await stevekrouse.fetchJSON(
`https://api.val.town/eval/${stateName} = ${now}`
);
const next = await stevekrouse.fetchJSON(
`https://api.val.town/eval/${stateName}`
).data;
if (next === now) return "❌ Unauthenticated can mutate state";
else if (next !== last)
return `❌ ${stateName} changed from ${last} to ${next}`;
else return `✅ ${stateName} remains ${last}`;
}
Updated: October 23, 2023