diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 22e312113..86a8317ec 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -15,6 +15,4 @@ jobs: uses: actions/setup-node@v3 - name: Run integration tests - # TODO: Replace the following 'run' statement with the following when TEST_SQUARE_TOKEN secret exists. - # run: yarn && yarn test:integration - run: yarn + run: yarn && yarn test:integration diff --git a/package.json b/package.json index 0dc6e6508..51ed007af 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "prepack": "cp -rv dist/. .", "test": "yarn test:unit", "test:unit": "jest --testPathPattern=tests/unit", - "test:integration": "jest --testPathPattern=tests/integration" + "test:integration": "jest '.*tests\\/integration\\/(?!.*\\.serial\\.test\\.ts$).*\\.test\\.ts$'; jest '.*tests\\/integration\\/.*\\.serial\\.test\\.ts$' --runInBand" }, "dependencies": { "url-join": "4.0.1", diff --git a/tests/integration/customerGroups.test.ts b/tests/integration/customerGroups.test.ts index 9612440cc..14c14be88 100644 --- a/tests/integration/customerGroups.test.ts +++ b/tests/integration/customerGroups.test.ts @@ -17,19 +17,19 @@ function deleteTestCustomerGroup(client: SquareClient, groupId: string): Promise describe("CustomerGroups API", () => { const client = createClient(); - it("should list customer groups", async () => { - const response = await client.customers.groups.list(); - - expect(response.data).toBeDefined(); - expect(response.data.length).toBeGreaterThan(0); - }); - - it("should create a customer group", async () => { + it("should create and list a customer group", async () => { + // create const response = await createTestCustomerGroup(client); expect(response.group).toBeDefined(); expect(response.group?.name).toBeDefined(); + // list + const listResponse = await client.customers.groups.list(); + + expect(listResponse.data).toBeDefined(); + expect(listResponse.data.length).toBeGreaterThan(0); + // Cleanup await deleteTestCustomerGroup(client, response.group?.id!); }); diff --git a/tests/integration/disputes.test.ts b/tests/integration/disputes.test.ts index 1554becce..35944330b 100644 --- a/tests/integration/disputes.test.ts +++ b/tests/integration/disputes.test.ts @@ -8,7 +8,7 @@ describe("Disputes API", () => { beforeAll(async () => { // Create a payment that will generate a dispute - await client.payments.create({ + const paymentsResp = await client.payments.create({ idempotencyKey: newTestUuid(), autocomplete: true, sourceId: "cnon:card-nonce-ok", @@ -19,7 +19,7 @@ describe("Disputes API", () => { }); // Poll for dispute to be created - for (let i = 0; i < 20; i++) { + for (let i = 0; i < 100; i++) { const disputeResponse = await client.disputes.list({ states: "EVIDENCE_REQUIRED", }); @@ -45,7 +45,7 @@ describe("Disputes API", () => { evidenceText: "This is not a duplicate", }); textEvidenceId = evidenceResponse.evidence!.id!; - }, 60_000); + }, 200_000); afterAll(async () => { // Clean up evidence if it exists