Skip to content

Commit

Permalink
fix: removed websocket in light rest node
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyLaw committed Dec 6, 2024
1 parent 32fa4d6 commit f9ba071
Showing 1 changed file with 17 additions and 24 deletions.
41 changes: 17 additions & 24 deletions test/NodeMonitor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,16 +194,11 @@ describe('NodeMonitor', () => {
isAvailable: true,
lastStatusCheck: 1000,
};
const mockApiStatus = {
const mockLightApiStatus = {
restGatewayUrl: 'https://abc.com:3001',
isAvailable: true,
isHttpsEnabled: true,
lastStatusCheck: 1000,
webSocket: {
isAvailable: true,
wss: true,
url: 'wss://abc.com:3001/ws',
},
nodePublicKey: 'node public key',
chainHeight: 10,
finalization: {
Expand All @@ -214,6 +209,18 @@ describe('NodeMonitor', () => {
},
restVersion: '1.0.0',
};
const mockFullApiStatus = {
...mockLightApiStatus,
nodeStatus: {
apiNode: 'up',
db: 'up',
},
webSocket: {
isAvailable: true,
wss: true,
url: 'wss://abc.com:3001/ws',
},
};

let stubHostDetailCached: any;
let stubPeerStatus: any;
Expand Down Expand Up @@ -280,7 +287,7 @@ describe('NodeMonitor', () => {
// Arrange:
stubHostDetailCached.returns(Promise.resolve(mockGeoInfo));
stubPeerStatus.returns(Promise.resolve(mockPeerStatus));
stubApiStatus.returns(Promise.resolve(mockApiStatus) as any);
stubApiStatus.returns(Promise.resolve(mockLightApiStatus) as any);

// Act:
const result = await (nodeMonitor as any).getNodeInfo(mockNodeInfo);
Expand All @@ -290,23 +297,15 @@ describe('NodeMonitor', () => {
...mockNodeInfo,
hostDetail: mockGeoInfo,
peerStatus: mockPeerStatus,
apiStatus: mockApiStatus,
apiStatus: mockLightApiStatus,
});
});

it('returns api node info', async () => {
// Arrange:
stubHostDetailCached.returns(Promise.resolve(mockGeoInfo));
stubPeerStatus.returns(Promise.resolve(mockPeerStatus));
stubApiStatus.returns(
Promise.resolve({
...mockApiStatus,
nodeStatus: {
apiNode: 'up',
db: 'up',
},
}) as any,
);
stubApiStatus.returns(Promise.resolve(mockFullApiStatus) as any);

// Act:
const result = await (nodeMonitor as any).getNodeInfo(mockNodeInfo);
Expand All @@ -316,13 +315,7 @@ describe('NodeMonitor', () => {
...mockNodeInfo,
hostDetail: mockGeoInfo,
peerStatus: mockPeerStatus,
apiStatus: {
...mockApiStatus,
nodeStatus: {
apiNode: 'up',
db: 'up',
},
},
apiStatus: mockFullApiStatus,
});
});
});
Expand Down

0 comments on commit f9ba071

Please sign in to comment.