refactor(opencode): roll out serviceUse proxy across 14 services + tests (#28576)
This commit is contained in:
@@ -88,7 +88,7 @@ it.live("login normalizes trailing slashes in the provided server URL", () =>
|
||||
}),
|
||||
)
|
||||
|
||||
const result = yield* Account.Service.use((s) => s.login("https://one.example.com/")).pipe(
|
||||
const result = yield* Account.use.login("https://one.example.com/").pipe(
|
||||
Effect.provide(live(client)),
|
||||
)
|
||||
|
||||
@@ -109,7 +109,7 @@ it.live("login maps transport failures to account transport errors", () =>
|
||||
)
|
||||
|
||||
const error = yield* Effect.flip(
|
||||
Account.Service.use((s) => s.login("https://one.example.com")).pipe(Effect.provide(live(client))),
|
||||
Account.use.login("https://one.example.com").pipe(Effect.provide(live(client))),
|
||||
)
|
||||
|
||||
expect(error).toBeInstanceOf(AccountTransportError)
|
||||
@@ -163,7 +163,7 @@ it.live("orgsByAccount groups orgs per account", () =>
|
||||
}),
|
||||
)
|
||||
|
||||
const rows = yield* Account.Service.use((s) => s.orgsByAccount()).pipe(Effect.provide(live(client)))
|
||||
const rows = yield* Account.use.orgsByAccount().pipe(Effect.provide(live(client)))
|
||||
|
||||
expect(rows.map((row) => [row.account.id, row.orgs.map((org) => org.id)]).map(([id, orgs]) => [id, orgs])).toEqual([
|
||||
[AccountID.make("user-1"), [OrgID.make("org-1")]],
|
||||
@@ -201,12 +201,12 @@ it.live("token refresh persists the new token", () =>
|
||||
),
|
||||
)
|
||||
|
||||
const token = yield* Account.Service.use((s) => s.token(id)).pipe(Effect.provide(live(client)))
|
||||
const token = yield* Account.use.token(id).pipe(Effect.provide(live(client)))
|
||||
|
||||
expect(Option.getOrThrow(token)).toBeDefined()
|
||||
expect(String(Option.getOrThrow(token))).toBe("at_new")
|
||||
|
||||
const row = yield* AccountRepo.Service.use((r) => r.getRow(id))
|
||||
const row = yield* AccountRepo.use.getRow(id)
|
||||
const value = Option.getOrThrow(row)
|
||||
expect(value.access_token).toBe(AccessToken.make("at_new"))
|
||||
expect(value.refresh_token).toBe(RefreshToken.make("rt_new"))
|
||||
@@ -246,12 +246,12 @@ it.live("token refreshes before expiry when inside the eager refresh window", ()
|
||||
}),
|
||||
)
|
||||
|
||||
const token = yield* Account.Service.use((s) => s.token(id)).pipe(Effect.provide(live(client)))
|
||||
const token = yield* Account.use.token(id).pipe(Effect.provide(live(client)))
|
||||
|
||||
expect(String(Option.getOrThrow(token))).toBe("at_new")
|
||||
expect(refreshCalls).toBe(1)
|
||||
|
||||
const row = yield* AccountRepo.Service.use((r) => r.getRow(id))
|
||||
const row = yield* AccountRepo.use.getRow(id)
|
||||
const value = Option.getOrThrow(row)
|
||||
expect(value.access_token).toBe(AccessToken.make("at_new"))
|
||||
expect(value.refresh_token).toBe(RefreshToken.make("rt_new"))
|
||||
@@ -315,7 +315,7 @@ it.live("concurrent config and token requests coalesce token refresh", () =>
|
||||
expect(String(Option.getOrThrow(token))).toBe("at_new")
|
||||
expect(refreshCalls).toBe(1)
|
||||
|
||||
const row = yield* AccountRepo.Service.use((r) => r.getRow(id))
|
||||
const row = yield* AccountRepo.use.getRow(id)
|
||||
const value = Option.getOrThrow(row)
|
||||
expect(value.access_token).toBe(AccessToken.make("at_new"))
|
||||
expect(value.refresh_token).toBe(RefreshToken.make("rt_new"))
|
||||
@@ -388,7 +388,7 @@ it.live("poll stores the account and first org on success", () =>
|
||||
expect(res.email).toBe("user@example.com")
|
||||
}
|
||||
|
||||
const active = yield* AccountRepo.Service.use((r) => r.active())
|
||||
const active = yield* AccountRepo.use.active()
|
||||
expect(Option.getOrThrow(active)).toEqual(
|
||||
expect.objectContaining({
|
||||
id: "user-1",
|
||||
|
||||
Reference in New Issue
Block a user