@elench/testkit 0.1.81 → 0.1.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -380,32 +380,39 @@ Named HTTP profiles live in `testkit.config.ts` and can be referenced by name:
380
380
 
381
381
  ```ts
382
382
  import { defineHttpSuite } from "@elench/testkit";
383
- import { defineConfig, profiles } from "@elench/testkit/config";
383
+ import { auth, defineConfig } from "@elench/testkit/config";
384
+
385
+ const appAuth = auth.fixture({
386
+ contract: auth.contracts.jsonSession({
387
+ authCookie: "session",
388
+ organizationIdPath: "data.organizations[0].id",
389
+ }),
390
+ topology: auth.topologies.crossOrg({
391
+ namespace: "example-app",
392
+ actors: {
393
+ primary: { org: "primary" },
394
+ reviewer: { org: "primary" },
395
+ outsider: { org: "secondary" },
396
+ },
397
+ }),
398
+ });
384
399
 
385
400
  export default defineConfig({
386
401
  profiles: {
387
- http: {
388
- defaultAuth: profiles.localJson({
389
- password: "password",
390
- identities: {
391
- primary: {
392
- email: "test@example.com",
393
- },
394
- },
395
- session: {
396
- authCookie: "session",
397
- },
398
- headers: {
399
- contentTypeJson: true,
400
- forwardedFor: "deterministic",
401
- },
402
- }).session(),
403
- },
402
+ http: appAuth.profiles({
403
+ defaultAuth: auth.profile.actor("primary"),
404
+ reviewers: auth.profile.actors({
405
+ actors: ["reviewer", "outsider"],
406
+ primaryActor: "reviewer",
407
+ }),
408
+ raw: auth.profile.raw(),
409
+ }),
404
410
  },
405
411
  });
406
412
 
407
- const suite = defineHttpSuite({ profile: "defaultAuth" }, ({ req, setupData }) => {
408
- req("GET", "/api/auth/session", setupData);
413
+ const suite = defineHttpSuite({ profile: "defaultAuth" }, ({ actor, req }) => {
414
+ req.get("/api/auth/session");
415
+ actor?.req.get("/api/auth/session");
409
416
  });
410
417
  ```
411
418
 
@@ -455,7 +462,7 @@ Consumers should not set local timeout values in test files.
455
462
  import { waitFor } from "@elench/testkit/runtime";
456
463
 
457
464
  const response = waitFor(
458
- () => req("GET", "/api/v1/jobs/123", setupData),
465
+ () => req.get("/api/v1/jobs/123"),
459
466
  (res) => JSON.parse(res.body).data?.status === "completed",
460
467
  { description: "job 123 to complete" }
461
468
  );