MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / seed

Function seed

packages/core/api/src/admin/admin-users.test.ts:155–192  ·  view source on GitHub ↗
(db: SqliteTestFumaDb)

Source from the content-addressed store, hash-verified

153/** Two users with connections under tenant A, plus a whole separate tenant B
154 * that A's admin plane must never see. */
155const seed = (db: SqliteTestFumaDb): Effect.Effect<void> =>
156 Effect.gen(function* () {
157 // `touchSubject` keeps a process-local memory of principals it already
158 // filed, so a second seed against a FRESH database would be skipped as a
159 // repeat sighting and leave the table empty. Each seed is a new world.
160 resetSubjectTouchCache();
161
162 yield* touchSubject(db.db, { tenant: TENANT_A, externalId: USER_A1 });
163 yield* touchSubject(db.db, { tenant: TENANT_A, externalId: USER_A2 });
164 yield* touchSubject(db.db, { tenant: TENANT_B, externalId: USER_B1 });
165
166 yield* insertConnection(db, {
167 rowId: "c-a1-gh",
168 tenant: TENANT_A,
169 owner: "user",
170 subject: USER_A1,
171 integration: "github",
172 name: "personal",
173 oauthScope: "repo read:user",
174 });
175 yield* insertConnection(db, {
176 rowId: "c-a2-linear",
177 tenant: TENANT_A,
178 owner: "user",
179 subject: USER_A2,
180 integration: "linear",
181 name: "work",
182 });
183 yield* insertConnection(db, {
184 rowId: "c-b1-gh",
185 tenant: TENANT_B,
186 owner: "user",
187 subject: USER_B1,
188 integration: "github",
189 name: "b-secret",
190 oauthScope: "admin:org",
191 });
192 });
193
194const platformExecutorFor = (db: SqliteTestFumaDb, tenant: string): Effect.Effect<Executor> =>
195 createExecutor({

Callers 1

Calls 3

resetSubjectTouchCacheFunction · 0.85
touchSubjectFunction · 0.85
insertConnectionFunction · 0.70

Tested by

no test coverage detected