1
0

Signing in puts people in the building

`member` and `anon` were told apart inside the office by the client and by
nothing else. `access.ts` picked an `officeDepth`, `createOfficeScene` built a
presence layer at full depth — and then nobody ever called `setPresence`, so
both tiers rendered the identical empty room. A tier that changes nothing you
can see is not a tier, and `routes/markers.ts` had already written down why one
drawn only in the browser is worse than none: it is a UI hiding a control over a
body the API hands to whoever asks.

So the refusal happens on the server now.

`GET /api/v1/offices/:id/presence` is the one route that always takes a session,
whatever else the deployment is configured for. `markers.ts` serves its feed to
anonymous callers when no feed is configured, on the grounds that there is
nothing there to protect; that reasoning does not transfer, and the difference is
the whole point — a marker is a company at an address and a presence is a person
at a desk.

The ordering inside the handler is the security property, not a detail. It
resolves the viewer *before* it looks at the id, so an anonymous caller gets an
identical 401 for a real office, a private one and one that was never created.
Check the office first and 404-for-unknown against 401-for-known tells them apart
perfectly, which is the enumeration oracle CONTRACT.md §6 forbids, wearing a
different status code. Three requests and one `deepEqual` hold that down.

`TERA_PRESENCE_DIR` is a second directory rather than a `people` field on the
pack, and that is the design. `types.ts` says a `Presence` binds to a `seatId`
and never to a coordinate so the geometry can be published while the people
cannot — which buys nothing if both live in one file, because an operator who
wants a public floorplan then has to strip the roster out by hand, and the first
time they forget the leak is permanent. Two directories makes the safe thing the
default thing. An office with no roster is 200 and empty, never 404: "no such
office" and "nobody has told me who is in this one" are different problems with
different fixes, and one 404 sends an operator after the wrong one.

On the client, occupancy arrives after the room is on screen rather than before —
the building is worth looking at while a second request is in flight. An API that
answers is believed, including when it answers with nobody; an office where
everyone has gone home is a real fact and overwriting it with invented people to
liven up the demo is the one thing this must never do. An API that does not
answer falls back to a fabricated roster, exactly as the markers do, because a
clone with no server is the flagship case and a member shown the same empty room
as a stranger has been told the tier means something when it does not.

Those twenty-five people are invented and the page says so. `sample.ts` says it
to a reader of the source; `#office-badge` now says "Sample occupancy — these
people are invented" to the person looking at the room, and it is not suppressed
when a real deployment's API merely happened to be down — that is exactly the
case where a member would otherwise read invented names as their colleagues.
Fabricated names at real desks look like a staff list, and a screenshot of one
must not be possible to take without the caption.

The floor plan marks the occupied desks, one colour for everybody where the
scene has four: at three device pixels a hue is a guess. The plan answers "is
anyone there" and the room answers "who, and what are they doing". Hovering a
desk names them, and the readout reads as an address getting more specific —
metres, then room, then person.

server: 127 tests pass, 11 of them new. Client typechecks and builds; the office
chunk absorbed the plan renderer and the entry chunk moved 2.3 kB for the sample
roster. Checked in the browser at office.lumbridgecorp.com: FULL VIEW, the badge,
figures at the benches, dots on the plan, and "3.7, 16.7 m · Alcatraz ·
Clementine Roux" under the pointer.
This commit is contained in:
2026-08-06 01:58:22 -07:00
parent df534c3530
commit 3e9b97ed8b
13 changed files with 856 additions and 5 deletions
+2
View File
@@ -30,6 +30,7 @@ without breaking the typecheck, which is the wrong order to find out.
| `GET /api/v1/weather` | `?city=` or `?lat=&lng=`; **400** for a place this box does not serve | `WeatherBody` | public, `TERA_WEATHER_TTL` |
| `GET /api/v1/markers` | — | `MarkersBody` | **private; 401 unless signed in** — public empty body when `TERA_MARKERS_SOURCE=none` |
| `GET /api/v1/offices/:id` | — | `OfficeDoc` | public offices only |
| `GET /api/v1/offices/:id/presence` | — | `PresenceBody` | **private; 401 unless signed in** — never publicly cached |
Every body is declared once, in `src/server/wire.ts` in the **root** package —
type-only, so it compiles to nothing and both the browser build and this service
@@ -231,6 +232,7 @@ Setting it is a licence claim you are making on the record.
| variable | default | what it does |
| --- | --- | --- |
| `TERA_OFFICES_DIR` | *(empty)* | One `<id>.json` per office. Empty means no offices. |
| `TERA_PRESENCE_DIR` | *(empty)* | One `<officeId>.json` per roster. Empty means nobody is in. **Keep this directory separate from the offices one** — a pack is publishable and a roster never is. |
| `TERA_AUTH_MODE` | `none` | `none`, `sso`, `jwt`. |
| `TERA_AUTH_ENTRY_URL` | *(empty)* | Where a browser sends someone to sign in. `sso`. |
| `TERA_AUTH_REVALIDATE_URL` | *(empty)* | Server-side token check. `sso`. |
+2
View File
@@ -19,6 +19,7 @@ import { registerFlights } from "./routes/flights.ts";
import { registerHealth } from "./routes/health.ts";
import { registerMarkers } from "./routes/markers.ts";
import { registerOffices } from "./routes/offices.ts";
import { registerPresence } from "./routes/presence.ts";
import { registerSession } from "./routes/session.ts";
import { registerWeather } from "./routes/weather.ts";
import { createServices } from "./services.ts";
@@ -47,6 +48,7 @@ export function buildApp(config: Config = loadConfig()): FastifyInstance {
registerWeather(app, services);
registerMarkers(app, services);
registerOffices(app, services);
registerPresence(app, services);
registerSession(app, services);
app.setNotFoundHandler(async (_req, reply) => {
+7
View File
@@ -148,6 +148,12 @@ export interface Config {
flights: FlightsConfig;
markers: MarkersConfig;
offices: { dir: string };
/**
* Where the rosters are. Separate from `offices.dir` because the two hold
* different kinds of secret — see `presence/store.ts`. Unset is the default
* and means nobody is in any building, which renders correctly.
*/
presence: { dir: string };
auth: AuthConfig;
/** One sentence per demotion. Empty on a fully-configured box. */
degraded: string[];
@@ -189,6 +195,7 @@ export function loadConfig(env: Env = process.env): Config {
flights,
markers,
offices: { dir: str(env, "TERA_OFFICES_DIR", "") },
presence: { dir: str(env, "TERA_PRESENCE_DIR", "") },
auth,
degraded,
};
+128
View File
@@ -0,0 +1,128 @@
/**
* Who is in the building, off disk.
*
* `TERA_PRESENCE_DIR` holds one `<officeId>.json` per office, in the same shape
* and by the same rules as `offices/store.ts`: hand-written, no database, no
* build step. The two are deliberately separate directories rather than one
* document with a `people` field on it, and that separation is the whole design
* rather than a filing preference.
*
* ### Why occupancy is not part of the office pack
*
* `src/interiors/types.ts` says a `Presence` binds to a `seatId` and never to a
* coordinate, so that the office geometry can be published and the people cannot
* be inferred from it. That rule buys nothing if the two live in the same file:
* an operator who wants to make their floorplan public would have to strip the
* roster out of it by hand every time, and the first time they forget, the leak
* is permanent and public. Two directories means the safe thing is the default
* thing — `TERA_OFFICES_DIR` can be world-readable, backed up and copied around,
* and it still contains no people.
*
* It is also the honest shape for where the data comes from. A floorplan changes
* when somebody moves a wall; a roster changes when somebody sits down. The pack
* is a document and this is a reading, so the reading carries `observedAt` and
* the pack does not.
*
* ### A box with no presence directory has no people
*
* That is the zero-config default and it is not an error: the reference office
* renders perfectly with nobody in it, which is what `presence.ts` means when it
* says the public building is "the same building, before anyone arrived". The
* route above turns that into an empty list and a 200, never a 404 — see
* `routes/presence.ts` for why the absence of a roster must not be reported the
* same way as the absence of an office.
*/
import { readFile } from "node:fs/promises";
import { join } from "node:path";
import type { PresenceBody } from "../../../src/server/wire.ts";
import type { Presence } from "../../../src/interiors/types.ts";
/**
* Ids are the filename, so this is a path-traversal boundary and not a style
* preference — the same pattern `offices/store.ts` uses, and it has to be the
* same one, because the two directories are addressed by the same id and a
* pattern that accepted more here would be the weaker of the two.
*/
const ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,63}$/;
/**
* A ceiling on how many people one office may report.
*
* Not a policy about office size — it is a bound on what a bad file can do to a
* browser. Every presence is a mesh and a draw call, so a roster with fifty
* thousand rows in it, whether by mistake or otherwise, is a tab that stops
* responding. Dropping the tail is visible and recoverable; the alternative is
* not.
*/
const MAX_PEOPLE = 2000;
export interface PresenceStore {
/** Never throws and never 404s. An office with no roster has an empty one. */
get(officeId: string): Promise<PresenceBody>;
}
export function createPresenceStore(dir: string): PresenceStore {
return {
async get(officeId: string): Promise<PresenceBody> {
const empty: PresenceBody = { officeId, people: [] };
if (dir === "" || !ID_PATTERN.test(officeId)) return empty;
try {
const parsed: unknown = JSON.parse(
await readFile(join(dir, `${officeId}.json`), "utf8"),
);
return normalise(parsed, officeId) ?? empty;
} catch {
// Missing, unreadable and unparseable are the same answer: nobody is
// recorded as being here. Distinguishing them out loud would leak the
// directory listing one status code at a time, which is the reasoning
// `offices/store.ts` already committed to for the same directory shape.
return empty;
}
},
};
}
function normalise(parsed: unknown, officeId: string): PresenceBody | null {
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
const doc = parsed as { people?: unknown; observedAt?: unknown };
if (!Array.isArray(doc.people)) return null;
const people: Presence[] = [];
for (const row of doc.people) {
const person = normalisePerson(row);
// A row that cannot be placed is dropped rather than repaired, and there is
// no id or seat invented for it. `presence.ts` drops an unplaceable presence
// for the same reason at the other end of the wire: putting somebody at a
// made-up desk turns a private id into a public coordinate, which is the one
// thing this whole split exists to stop.
if (person !== null) people.push(person);
if (people.length >= MAX_PEOPLE) break;
}
return {
officeId,
people,
...(typeof doc.observedAt === "string" ? { observedAt: doc.observedAt } : {}),
};
}
function normalisePerson(row: unknown): Presence | null {
if (row === null || typeof row !== "object" || Array.isArray(row)) return null;
const p = row as Partial<Presence>;
if (typeof p.seatId !== "string" || p.seatId === "") return null;
// The id defaults to the seat, because a roster where one desk is listed twice
// is a mistake in the file and not something to render twice; `presence.ts`
// keys its meshes by presence id, so two rows sharing one would be one person.
// The label defaults to nothing rather than to the seat id: a hover card
// reading "eng-04" is the desk answering a question about the person.
return {
id: typeof p.id === "string" && p.id !== "" ? p.id : p.seatId,
seatId: p.seatId,
label: typeof p.label === "string" ? p.label : "",
colorKey: typeof p.colorKey === "string" ? p.colorKey : "in",
...(typeof p.url === "string" ? { url: p.url } : {}),
...(typeof p.blurb === "string" ? { blurb: p.blurb } : {}),
};
}
+80
View File
@@ -0,0 +1,80 @@
/**
* `GET /api/v1/offices/:id/presence` — the route that makes signing in mean
* something.
*
* Until this existed, `member` and `anon` were told apart by the client and by
* nothing else *inside the office*: `access.ts` picked `officeDepth`, the scene
* built a presence layer at full depth, and then nobody ever called
* `setPresence`, so both tiers rendered the identical empty building. A tier
* that changes nothing you can see is not a tier, and — exactly as
* `routes/markers.ts` argues for the city — a distinction drawn only in the
* browser is a UI hiding a control over a body the API hands to whoever asks.
* This is where the refusal actually happens.
*
* ### Occupancy always takes a session. Markers only sometimes do.
*
* `markers.ts` serves its feed to anonymous callers when no feed is configured,
* on the grounds that there is nothing there to protect. The same reasoning does
* **not** transfer, and the difference is worth stating rather than inferring:
* a marker is a company at an address and a presence is a person at a desk. So
* the auth check here is unconditional. A box with no roster still answers 200
* and an empty list — see below — but it answers it to a caller who signed in.
*
* ### 401 here, and why that is not the enumeration oracle §6 forbids
*
* CONTRACT.md §6 says a private office answers 404 rather than 403 so the id
* space cannot be walked for a tenant list, and `offices.ts` implements exactly
* that. This route resolves the viewer **first**, before it has looked at the id
* at all, so an anonymous caller gets the same 401 for every id in the world —
* real, private, or invented. Nothing is learned. Only a caller who has already
* signed in reaches the point where ids differ, and at that point they can
* already read `/offices/:id`, so this leaks nothing that route does not.
*
* Doing it in the other order is the bug this comment exists to prevent: check
* the office first and an anonymous 404-for-unknown against 401-for-known
* distinguishes them perfectly, which is the oracle wearing a different status
* code.
*
* ### An office with no roster is 200 and empty, never 404
*
* `store.ts` cannot fail, and that is deliberate. "This office does not exist"
* and "nobody has told me who is in this office" are different facts with
* different fixes — one is a wrong URL, the other is an unset
* `TERA_PRESENCE_DIR` — and collapsing them into one 404 sends an operator
* looking for the wrong problem. The empty building is also the correct render:
* it is what the office looks like before anyone arrives.
*/
import type { FastifyInstance } from "fastify";
import type { ErrorBody } from "../../../src/server/wire.ts";
import type { Services } from "../services.ts";
const UNAUTHORIZED: ErrorBody = {
error: "unauthorized",
message: "Occupancy is for signed-in members.",
};
const NOT_FOUND: ErrorBody = { error: "not_found", message: "No such office." };
export function registerPresence(app: FastifyInstance, services: Services): void {
app.get<{ Params: { id: string } }>("/api/v1/offices/:id/presence", async (req, reply) => {
// Viewer first, before the id is looked at. See the header — the order is
// the security property, not an implementation detail.
const viewer = await services.auth.resolve(req);
if (!viewer.authenticated) {
return reply.code(401).header("www-authenticate", "Bearer").send(UNAUTHORIZED);
}
// Then the office, by the same rule `offices.ts` applies: an office this
// viewer may not see is indistinguishable from one that is not there.
const doc = await services.offices.get(req.params.id);
if (doc === null) return reply.code(404).send(NOT_FOUND);
// No `publicCache`, ever. This body took a credential to obtain and names
// people; a shared cache holding it would hand one member's copy to the next
// caller, which is precisely what the fail-closed default in `cache.ts`
// exists to prevent. Saying so here rather than staying silent, because the
// absence of a call is not self-evidently a decision.
return services.presence.get(req.params.id);
});
}
+3
View File
@@ -11,6 +11,7 @@ import { createAuth, type AuthService } from "./auth/index.ts";
import { createFlightsService, type FlightsService } from "./flights/index.ts";
import { createMarkerStore, type MarkerStore } from "./markers/store.ts";
import { createOfficeStore, type OfficeStore } from "./offices/store.ts";
import { createPresenceStore, type PresenceStore } from "./presence/store.ts";
import { createWeatherService, type WeatherService } from "./weather/index.ts";
import type { Config } from "./config.ts";
@@ -20,6 +21,7 @@ export interface Services {
flights: FlightsService;
markers: MarkerStore;
offices: OfficeStore;
presence: PresenceStore;
auth: AuthService;
/** Epoch milliseconds, for `uptimeSeconds` on the health body. */
startedAt: number;
@@ -37,6 +39,7 @@ export function createServices(config: Config, log: ServiceLog): Services {
flights: createFlightsService(config, log),
markers: createMarkerStore(config, log),
offices: createOfficeStore(config.offices.dir),
presence: createPresenceStore(config.presence.dir),
auth: createAuth(config.auth),
startedAt: Date.now(),
};
+285
View File
@@ -0,0 +1,285 @@
/**
* Occupancy: the refusal, the ordering that makes it safe, and the file.
*
* Two assertions carry this file and both are negative.
*
* The first is the refusal itself. Before this route, `member` and `anon`
* differed *inside the office* only in the browser: the client picked a depth
* and the server never refused anybody anything. `markers.test.ts` makes the
* same argument for the city and it is the same argument — a tier drawn in the
* client is a UI hiding a control over a body the API hands to whoever asks.
*
* The second is the ordering, and it is the subtler one. CONTRACT.md §6 forbids
* an endpoint that lets the id space be walked for a tenant list. This route
* resolves the viewer before it looks at the id, so an anonymous caller gets an
* identical 401 for a real office, a private one and one that was never created.
* Check the office first and the status codes tell them apart perfectly, which
* is the enumeration oracle wearing a different number. The test for that is
* three requests and one `deepEqual`.
*
* Follows `offices.test.ts`: a temp directory, `buildApp` over a fake
* environment, `inject()` rather than a socket, and HS256 by hand.
*/
import assert from "node:assert/strict";
import { createHmac } from "node:crypto";
import { mkdtemp, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { after, before, describe, it } from "node:test";
import { buildApp } from "../app.ts";
import { loadConfig } from "../config.ts";
import type { PresenceBody } from "../../../src/server/wire.ts";
const SECRET = "not-a-real-secret-and-never-was";
/** A minimal floor. `Plan` is what makes sense of it; the API only carries it. */
const floor = { id: "hq", name: "HQ", levels: [], viewpoints: [] };
let offices = "";
let presence = "";
before(async () => {
offices = await mkdtemp(join(tmpdir(), "tera-offices-"));
presence = await mkdtemp(join(tmpdir(), "tera-presence-"));
await writeFile(
join(offices, "open.json"),
JSON.stringify({ id: "open", name: "Open office", visibility: "public", floor }),
);
await writeFile(
join(offices, "closed.json"),
JSON.stringify({ id: "closed", name: "Closed office", visibility: "private", floor }),
);
// An office with no roster beside it. Deliberately: "no such office" and
// "nobody has told me who is in this one" are different facts.
await writeFile(
join(offices, "empty.json"),
JSON.stringify({ id: "empty", name: "Empty office", visibility: "public", floor }),
);
await writeFile(
join(presence, "open.json"),
JSON.stringify({
observedAt: "2026-08-06T09:00:00.000Z",
people: [
{ id: "p-01", seatId: "eng-01", label: "Tobias Quillon", colorKey: "in" },
{ id: "p-02", seatId: "eng-02", label: "Ines Marchetti", colorKey: "focus" },
// No id: the seat stands in for one, because a roster listing one desk
// twice is a mistake in the file and not two people.
{ seatId: "eng-03", label: "Dara Oyelaran-Pike" },
// No seat: unplaceable, and dropped rather than repaired. Inventing a
// desk would turn a private id into a public coordinate.
{ id: "p-04", label: "Nobody In Particular" },
"not even an object",
],
}),
);
await writeFile(join(presence, "closed.json"), JSON.stringify({ people: [] }));
await writeFile(join(presence, "broken.json"), "{ this is not json");
});
function appWith(env: Record<string, string>) {
const config = loadConfig({
TERA_OFFICES_DIR: offices,
TERA_PRESENCE_DIR: presence,
...env,
});
config.logLevel = "silent";
return buildApp(config);
}
function hs256(claims: Record<string, unknown>): string {
const encode = (value: unknown): string =>
Buffer.from(JSON.stringify(value)).toString("base64url");
const signed = `${encode({ alg: "HS256", typ: "JWT" })}.${encode(claims)}`;
return `${signed}.${createHmac("sha256", SECRET).update(signed).digest("base64url")}`;
}
const jwt = { TERA_AUTH_MODE: "jwt", TERA_AUTH_JWT_SECRET: SECRET };
function bearer(): { authorization: string } {
return { authorization: `Bearer ${hs256({ sub: "someone", exp: nextHour() })}` };
}
/**
* An hour out, computed rather than written down: a fixed `exp` in a test file
* is a test that starts failing on a date nobody chose.
*/
function nextHour(): number {
return Math.floor(Date.now() / 1000) + 3600;
}
describe("the refusal", () => {
it("refuses an anonymous caller even for a public office", async () => {
const app = appWith(jwt);
after(() => app.close());
const res = await app.inject({ method: "GET", url: "/api/v1/offices/open/presence" });
assert.equal(res.statusCode, 401);
assert.equal(res.headers["www-authenticate"], "Bearer");
// The point: the office itself is public and readable by this same caller.
const doc = await app.inject({ method: "GET", url: "/api/v1/offices/open" });
assert.equal(doc.statusCode, 200);
});
it("tells a real, a private and an absent office apart for nobody", async () => {
const app = appWith(jwt);
after(() => app.close());
const real = await app.inject({ method: "GET", url: "/api/v1/offices/open/presence" });
const priv = await app.inject({ method: "GET", url: "/api/v1/offices/closed/presence" });
const gone = await app.inject({ method: "GET", url: "/api/v1/offices/no-such-thing/presence" });
assert.equal(real.statusCode, 401);
assert.equal(priv.statusCode, 401);
assert.equal(gone.statusCode, 401);
assert.deepEqual(real.json(), priv.json());
assert.deepEqual(real.json(), gone.json());
});
it("never lets a shared cache keep a roster", async () => {
const app = appWith(jwt);
after(() => app.close());
const res = await app.inject({
method: "GET",
url: "/api/v1/offices/open/presence",
headers: bearer(),
});
assert.equal(res.statusCode, 200);
assert.equal(res.headers["cache-control"], "private, no-store");
});
it("is unreachable by everyone when nobody can sign in", async () => {
// `TERA_AUTH_MODE=none` means no caller is ever authenticated, so this route
// refuses the whole world. That is the fail-closed direction and the same one
// a private office already takes.
const app = appWith({});
after(() => app.close());
const res = await app.inject({
method: "GET",
url: "/api/v1/offices/open/presence",
headers: bearer(),
});
assert.equal(res.statusCode, 401);
});
});
describe("the file", () => {
it("serves the roster to a signed-in caller", async () => {
const app = appWith(jwt);
after(() => app.close());
const res = await app.inject({
method: "GET",
url: "/api/v1/offices/open/presence",
headers: bearer(),
});
assert.equal(res.statusCode, 200);
const body = res.json<PresenceBody>();
assert.equal(body.officeId, "open");
assert.equal(body.observedAt, "2026-08-06T09:00:00.000Z");
assert.deepEqual(
body.people.map((p) => p.seatId),
["eng-01", "eng-02", "eng-03"],
);
});
it("drops the unplaceable and keeps the rest of the file", async () => {
const app = appWith(jwt);
after(() => app.close());
const body = (
await app.inject({
method: "GET",
url: "/api/v1/offices/open/presence",
headers: bearer(),
})
).json<PresenceBody>();
// A row with no seat and a row that is not an object are both gone, and
// neither took the three good rows with it.
assert.equal(body.people.length, 3);
assert.ok(!body.people.some((p) => p.label === "Nobody In Particular"));
});
it("stands the seat in for a missing id and defaults the colour", async () => {
const app = appWith(jwt);
after(() => app.close());
const body = (
await app.inject({
method: "GET",
url: "/api/v1/offices/open/presence",
headers: bearer(),
})
).json<PresenceBody>();
const third = body.people[2];
assert.equal(third?.id, "eng-03");
assert.equal(third?.colorKey, "in");
});
it("answers 200 and an empty list for an office with no roster", async () => {
// Not 404. An unset roster is a different problem from a wrong URL, and
// sending an operator looking for the wrong one costs them an afternoon.
const app = appWith(jwt);
after(() => app.close());
const res = await app.inject({
method: "GET",
url: "/api/v1/offices/empty/presence",
headers: bearer(),
});
assert.equal(res.statusCode, 200);
assert.deepEqual(res.json<PresenceBody>().people, []);
});
it("answers 404 to a signed-in caller for an office that is not there", async () => {
const app = appWith(jwt);
after(() => app.close());
const res = await app.inject({
method: "GET",
url: "/api/v1/offices/no-such-thing/presence",
headers: bearer(),
});
assert.equal(res.statusCode, 404);
});
it("treats an unreadable roster as an empty one", async () => {
// `broken.json` is not JSON. The building still renders; it renders empty.
const app = appWith(jwt);
after(() => app.close());
await writeFile(
join(offices, "broken.json"),
JSON.stringify({ id: "broken", name: "Broken", visibility: "public", floor }),
);
const res = await app.inject({
method: "GET",
url: "/api/v1/offices/broken/presence",
headers: bearer(),
});
assert.equal(res.statusCode, 200);
assert.deepEqual(res.json<PresenceBody>().people, []);
});
it("has no people at all when no presence directory is configured", async () => {
const config = loadConfig({ TERA_OFFICES_DIR: offices, ...jwt });
config.logLevel = "silent";
const app = buildApp(config);
after(() => app.close());
const res = await app.inject({
method: "GET",
url: "/api/v1/offices/open/presence",
headers: bearer(),
});
assert.equal(res.statusCode, 200);
assert.deepEqual(res.json<PresenceBody>().people, []);
});
});