Skip to content
Myr

session.test.ts

This file

Path

examples/burrow/packages/auth/test/session.test.ts

25 lines · 809 bytes · TypeScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than 678c8b8 point at it.

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 1–25why, one step back
1import assert from "node:assert/strict";
2import { test } from "node:test";34import { API } from "@burrow/kit";5import { fakeTransport } from "@burrow/kit/testing";67import { currentSession, isMember, signIn } from "../src/index.ts";89const session = { expiresAt: "2031-01-01T00:00:00Z", user: "wren" };1011const { transport } = fakeTransport(12 new Map([13 [`${API}/sessions/t-1`, JSON.stringify(session)],14 [`${API}/teams/ops`, JSON.stringify(["wren", "tamsin"])],15 ])16);1718test("signing in keeps the session as the current one", async () => {19 assert.deepEqual(await signIn("t-1", transport), session);20 assert.deepEqual(currentSession(), session);21});2223test("a session's user is a member of the teams that list them", async () => {24 assert.equal(await isMember(session, "ops", transport), true);25});