Skip to content

Commit 4ee4b4e

Browse files
authored
Merge pull request #263 from Chia-Network/explorer-test-fix
fix: explorer test
2 parents 308f4f5 + f56adda commit 4ee4b4e

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/api/retirement-explorer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,15 @@ const maybeAppendRetirementExplorerApiKey = (headers = {}) => {
3333
*/
3434
const getHomeOrgRetirementActivities = async (page, limit, minHeight) => {
3535
try {
36+
const homeOrgUid = await registry.getHomeOrgUid();
37+
3638
logger.debug(`GET ${retirementExplorerUri}/v1/activities`);
3739
const response = await superagent
3840
.get(`${retirementExplorerUri}/v1/activities`)
3941
.query({
4042
page,
4143
limit,
42-
org_uid: await registry.getHomeOrgUid(),
44+
org_uid: homeOrgUid,
4345
minHeight: Number(minHeight) + 1,
4446
sort: "asc",
4547
})

tests/retirement-explorer.test.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,21 @@ const nock = require("nock");
22
const { getHomeOrgRetirementActivities } = require("../src/api/retirement-explorer");
33
const { CONFIG } = require("../src/config");
44
const { generateUriForHostAndPort } = require("../src/utils");
5+
const HomeOrgMock = require("./data/HomeOrgMock");
6+
const OrganizationsMock = require("./data/OrganizationsMock");
57

68
const retirementExplorerUri = generateUriForHostAndPort(
79
CONFIG().RETIREMENT_EXPLORER.PROTOCOL,
810
CONFIG().RETIREMENT_EXPLORER.HOST,
911
CONFIG().RETIREMENT_EXPLORER.PORT
1012
);
1113

14+
const registryUri = generateUriForHostAndPort(
15+
CONFIG().CADT.PROTOCOL,
16+
CONFIG().CADT.HOST,
17+
CONFIG().CADT.PORT
18+
);
19+
1220
describe("getHomeOrgRetirementActivities", () => {
1321
const apiEndpoint = retirementExplorerUri;
1422
const mockResponse = {
@@ -21,8 +29,10 @@ describe("getHomeOrgRetirementActivities", () => {
2129
beforeEach(() => {
2230
nock(apiEndpoint)
2331
.get("/v1/activities")
24-
.query({ page: 1, limit: 10, org_uid: "a9d374baa8ced8b7a4add2a23f35f430fd7a3c99d1480d762e0b40572db4b024", minHeight: 1, sort: "asc" })
32+
.query({ page: 1, limit: 10, org_uid: HomeOrgMock.orgUid, minHeight: 1, sort: "asc" })
2533
.reply(200, mockResponse);
34+
35+
nock(registryUri).get("/v1/organizations").reply(200, OrganizationsMock);
2636
});
2737

2838
it('should filter out activities that do not have a mode of "PERMISSIONLESS_RETIREMENT"', async () => {

0 commit comments

Comments
 (0)