This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/main by this push:
new 564ccdbfd5 test(frontend): add spec for GoogleAuthService (#5457)
564ccdbfd5 is described below
commit 564ccdbfd51089f31dcfdcbdba9f5a872a2f8256
Author: Meng Wang <[email protected]>
AuthorDate: Mon Jun 8 13:42:02 2026 -0700
test(frontend): add spec for GoogleAuthService (#5457)
### What changes were proposed in this PR?
Adds a unit spec for `GoogleAuthService`, which previously had none.
Covers `getClientId()`:
- request shape — a single `GET` to `/auth/google/clientid` with
`responseType: "text"`
- success path — a 200 emits the returned client id
- error path — a 500 rejects with `HttpErrorResponse`
Follows `frontend/TESTING.md` (Vitest, `HttpClientTestingModule` +
`HttpTestingController`).
### Any related issues, documentation, discussions?
Closes #5454.
### How was this PR tested?
`yarn test --include='**/google-auth.service.spec.ts'` → 3 passed.
`prettier --check` clean.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-4-7)
---
.../service/user/google-auth.service.spec.ts | 55 ++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/frontend/src/app/common/service/user/google-auth.service.spec.ts
b/frontend/src/app/common/service/user/google-auth.service.spec.ts
new file mode 100644
index 0000000000..0c7bf1d95d
--- /dev/null
+++ b/frontend/src/app/common/service/user/google-auth.service.spec.ts
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { TestBed } from "@angular/core/testing";
+import { HttpClientTestingModule, HttpTestingController } from
"@angular/common/http/testing";
+import { firstValueFrom } from "rxjs";
+
+import { GoogleAuthService } from "./google-auth.service";
+import { AppSettings } from "../../app-setting";
+
+describe("GoogleAuthService", () => {
+ let service: GoogleAuthService;
+ let httpTestingController: HttpTestingController;
+ const expectedUrl = `${AppSettings.getApiEndpoint()}/auth/google/clientid`;
+
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ imports: [HttpClientTestingModule],
+ providers: [GoogleAuthService],
+ });
+ service = TestBed.inject(GoogleAuthService);
+ httpTestingController = TestBed.inject(HttpTestingController);
+ });
+
+ afterEach(() => {
+ httpTestingController.verify();
+ });
+
+ it("issues a GET to the client-id endpoint and emits the returned id", async
() => {
+ const clientId$ = firstValueFrom(service.getClientId());
+
+ const req = httpTestingController.expectOne(
+ r => r.method === "GET" && r.url === expectedUrl && r.responseType ===
"text"
+ );
+ req.flush("google-client-id-abc");
+
+ expect(await clientId$).toBe("google-client-id-abc");
+ });
+});