Skip to content

Commit 9565fd5

Browse files
committed
Gate reporting integration suite behind TEST_SQUARE_REPORTING (FER-11257)
Reporting is served only from production and needs a prod, reporting-provisioned token; CI's token is sandbox-only and 401s against prod, turning the integration job red. Gate the live suite behind TEST_SQUARE_REPORTING so it skips by default (CI green) while staying runnable on demand against a real prod account. Default target stays production. Polling logic remains covered by tests/unit/reporting.test.ts.
1 parent b2286d5 commit 9565fd5

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

tests/integration/reporting.test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ import type * as Square from "../../src/api";
33

44
// The Reporting API is a beta, bespoke offering served ONLY from production
55
// (connect.squareup.com/reporting) — it is not routed on sandbox (returns 404 there).
6-
// So, unlike the other integration suites (which target sandbox), this one targets
7-
// production by default and needs a production-capable TEST_SQUARE_TOKEN. The endpoints
8-
// are read-only (schema discovery + queries), so running them against prod is safe.
9-
// The polling *logic* is covered without a live account in tests/unit/reporting.test.ts.
6+
// Validating it live therefore needs a production, reporting-provisioned TEST_SQUARE_TOKEN.
7+
// CI's token is sandbox-only (it 401s against prod), so this suite is gated behind
8+
// TEST_SQUARE_REPORTING and skips by default — keeping CI green. The endpoints are
9+
// read-only (schema discovery + queries). The polling *logic* is covered without a live
10+
// account in tests/unit/reporting.test.ts.
1011
//
11-
// Run it:
12-
// TEST_SQUARE_TOKEN=<prod-access-token> yarn test:integration --testPathPattern reporting
12+
// Run it against a real prod account:
13+
// TEST_SQUARE_REPORTING=1 TEST_SQUARE_TOKEN=<prod-access-token> \
14+
// yarn test:integration --testPathPattern reporting
1315
// # override the host with TEST_SQUARE_BASE_URL=<url> if reporting moves.
16+
const describeReporting = process.env.TEST_SQUARE_REPORTING ? describe : describe.skip;
1417

1518
function createReportingClient(): SquareClient {
1619
const token = process.env.TEST_SQUARE_TOKEN;
@@ -24,7 +27,7 @@ function createReportingClient(): SquareClient {
2427
return new SquareClient({ token, baseUrl });
2528
}
2629

27-
describe("Reporting API (live)", () => {
30+
describeReporting("Reporting API (live)", () => {
2831
let client: SquareClient;
2932
beforeAll(() => {
3033
client = createReportingClient();

0 commit comments

Comments
 (0)