Skip to content

Commit caaedc7

Browse files
authored
Fix rates integration test timeout (#1)
* Fix rates integration test: add sort to avoid slow default query * Fix avg_interest_rates: use v2 endpoint (v1 returns empty on CI) * Separate unit tests from integration tests in npm test * Fix test: update expected endpoint path to v2
1 parent 5ce9735 commit caaedc7

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"scripts": {
1717
"build": "tsc",
1818
"dev": "tsx src/cli.ts",
19-
"test": "tsx --test src/tests/*.test.ts",
19+
"test": "tsx --test src/tests/client.test.ts src/tests/cli.test.ts",
2020
"test:watch": "tsx --test --watch src/tests/*.test.ts",
2121
"test:integration": "tsx --test src/tests/integration.test.ts",
2222
"prepublishOnly": "npm run build && npm test",

src/api/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class TreasuryClient {
6969
}
7070

7171
async getAvgInterestRates(params: QueryParams = {}): Promise<TreasuryResponse> {
72-
return this.request("v1/accounting/od/avg_interest_rates", params);
72+
return this.request("v2/accounting/od/avg_interest_rates", params);
7373
}
7474

7575
async getMspdTable1(params: QueryParams = {}): Promise<TreasuryResponse> {

src/tests/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ describe("TreasuryClient", () => {
127127
mockFetch(AVG_INTEREST_RATES_RESPONSE);
128128
const result = await client.getAvgInterestRates();
129129
const url = getCalledUrl();
130-
assert.equal(url.pathname, "/services/api/fiscal_service/v1/accounting/od/avg_interest_rates");
130+
assert.equal(url.pathname, "/services/api/fiscal_service/v2/accounting/od/avg_interest_rates");
131131
assert.equal(result.data.length, 2);
132132
});
133133

src/tests/integration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe("CLI integration (live API)", () => {
7171
});
7272

7373
it("treasury rates returns interest rate data", async () => {
74-
const { stdout } = await run(["rates", "--limit", "5"]);
74+
const { stdout } = await run(["rates", "--limit", "5", "--sort", "-record_date"]);
7575
const data = JSON.parse(stdout);
7676
assert.ok(Array.isArray(data.data));
7777
assert.ok(data.data.length > 0);

0 commit comments

Comments
 (0)