-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathauth-github-login-stream.test.ts
More file actions
28 lines (23 loc) · 1.26 KB
/
auth-github-login-stream.test.ts
File metadata and controls
28 lines (23 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { describe, expect, it } from "vitest"
import { renderGithubPostLoginOutput } from "../src/services/auth-github-login-stream.js"
describe("GitHub auth login stream", () => {
it("renders post-login state logs before the success marker", () => {
const output = renderGithubPostLoginOutput([
"Initializing state repository: https://github.com/octocat/.docker-git.git",
"State dir ready: /home/dev/.docker-git"
], "ok")
expect(output).toContain("Initializing state repository")
expect(output).toContain("State dir ready")
expect(output).toContain("GitHub login completed.")
expect(output).toContain("__DOCKER_GIT_GITHUB_LOGIN_STATUS__:ok")
expect(output.indexOf("State dir ready")).toBeLessThan(output.indexOf("GitHub login completed."))
})
it("renders post-login failure details before the failure marker", () => {
const output = renderGithubPostLoginOutput([
"GitHub login finished in browser, but post-login sync failed: git fetch failed"
], "post-login")
expect(output).toContain("post-login sync failed")
expect(output).toContain("__DOCKER_GIT_GITHUB_LOGIN_STATUS__:error:post-login")
expect(output.indexOf("post-login sync failed")).toBeLessThan(output.indexOf("__DOCKER_GIT_GITHUB_LOGIN_STATUS__"))
})
})