Skip to content

Commit

Permalink
fix: did a lintfix
Browse files Browse the repository at this point in the history
  • Loading branch information
CDeltakai committed Feb 25, 2025
1 parent 8e1f870 commit 364237b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/nodes/agent/handlers/NodesAuditEventsGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
AgentAuditMessage,
} from '../types';
import type Audit from '../../../audit/Audit';
import type { AuditEvent } from '@/audit/types';
import type { AuditEvent } from '../../../audit/types';
import { ServerHandler } from '@matrixai/rpc';
import * as auditUtils from '../../../audit/utils';

Expand Down
3 changes: 1 addition & 2 deletions src/nodes/agent/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type {
} from '@matrixai/rpc';
import type { SignedTokenEncoded } from '../../tokens/types';
import type {
AuditEventId,
AuditEventIdEncoded,
ClaimIdEncoded,
NodeIdEncoded,
Expand All @@ -15,7 +14,7 @@ import type { VaultAction, VaultName } from '../../vaults/types';
import type { SignedNotification } from '../../notifications/types';
import type { Host, Hostname, Port } from '../../network/types';
import type { NodeContact } from '../../nodes/types';
import type { AuditEvent } from '@/audit/types';
import type { AuditEvent } from '../../audit/types';

type AgentRPCRequestParams<T extends JSONObject = JSONObject> =
JSONRPCRequestParams<T>;
Expand Down
19 changes: 6 additions & 13 deletions tests/nodes/agent/handlers/nodesClaimsGet.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { IdentityId, ProviderId } from '@/identities/types';
import type { ClaimIdEncoded } from '@/ids';
import fs from 'fs';
import path from 'path';
import os from 'os';
Expand Down Expand Up @@ -198,7 +197,6 @@ describe('nodesClaimsGet', () => {
});

test('Should get chain data with limit', async () => {

const srcNodeIdEncoded = nodesUtils.encodeNodeId(keyRing.getNodeId());
// Add 10 claims
for (let i = 1; i <= 5; i++) {
Expand All @@ -224,8 +222,7 @@ describe('nodesClaimsGet', () => {
await sigchain.addClaim(identityLink);
}


let limitVal = 5;
const limitVal = 5;

const response = await rpcClient.methods.nodesClaimsGet({
limit: limitVal,
Expand Down Expand Up @@ -270,9 +267,8 @@ describe('nodesClaimsGet', () => {
for await (const claim of response) {
chainIds.push(claim.claimIdEncoded ?? '');
}


//Verify that chainIds are in descending order
// Verify that chainIds are in descending order
let isSorted = true;
for (let i = 0; i < chainIds.length - 1; i++) {
if (chainIds[i] < chainIds[i + 1]) {
Expand All @@ -281,7 +277,6 @@ describe('nodesClaimsGet', () => {
}
}
expect(isSorted).toBe(true);

});

test('Should get chain data with order asc', async () => {
Expand Down Expand Up @@ -318,7 +313,7 @@ describe('nodesClaimsGet', () => {
chainIds.push(claim.claimIdEncoded ?? '');
}

//Verify that chainIds are in ascending order
// Verify that chainIds are in ascending order
let isSorted = true;
for (let i = 0; i < chainIds.length - 1; i++) {
if (chainIds[i] > chainIds[i + 1]) {
Expand All @@ -331,19 +326,17 @@ describe('nodesClaimsGet', () => {

test('Should return no results when the DB is empty', async () => {
// We do not add any claims to the DB here, leaving it empty

// Make the RPC call without any parameters
const response = await rpcClient.methods.nodesClaimsGet({});

// Collect all results into an array
const claimIds: Array<string> = [];
for await (const claim of response) {
claimIds.push(claim.claimIdEncoded ?? '');
}

// Verify the array is empty
expect(claimIds).toHaveLength(0);
});


});

0 comments on commit 364237b

Please sign in to comment.