Skip to content

Commit 0646741

Browse files
committed
test(source-control): synchronize github credential overlap
1 parent 87fafdc commit 0646741

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎packages/source-control-github/src/server/GitHubPullRequestApi.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,7 @@ it.effect(
555555
it.effect("separates overlapping unpinned permission reads after a saved account switch", () =>
556556
Effect.gen(function* () {
557557
const started = yield* Deferred.make<void>();
558+
const broadStarted = yield* Deferred.make<void>();
558559
const release = yield* Deferred.make<void>();
559560
let activeToken = "restricted-credential";
560561
const requests: Array<{ readonly url: string; readonly authorization: string | undefined }> =
@@ -578,6 +579,9 @@ it.effect("separates overlapping unpinned permission reads after a saved account
578579
Effect.gen(function* () {
579580
const authorization = request.headers["authorization"];
580581
requests.push({ url: request.url, authorization });
582+
if (authorization === "Bearer broad-credential") {
583+
yield* Deferred.succeed(broadStarted, undefined);
584+
}
581585
yield* Deferred.succeed(started, undefined);
582586
yield* Deferred.await(release);
583587
return HttpClientResponse.fromWeb(
@@ -615,8 +619,8 @@ it.effect("separates overlapping unpinned permission reads after a saved account
615619
const fresh = yield* Effect.all([read, read], { concurrency: "unbounded" }).pipe(
616620
Effect.forkChild,
617621
);
618-
// Let both readers reach the pending request before answering either account.
619-
yield* Effect.yieldNow;
622+
// Keep both accounts' HTTP requests pending before answering either one.
623+
yield* Deferred.await(broadStarted);
620624
yield* Deferred.succeed(release, undefined);
621625

622626
expect((yield* Fiber.join(older)).comparison?.viewerCanUpdate).toBe(false);

0 commit comments

Comments
 (0)