diff --git a/ironfish/src/rpc/routes/config/getConfig.test.ts b/ironfish/src/rpc/routes/config/getConfig.test.ts index 01bf37d1d3..d471d70e1b 100644 --- a/ironfish/src/rpc/routes/config/getConfig.test.ts +++ b/ironfish/src/rpc/routes/config/getConfig.test.ts @@ -11,11 +11,9 @@ describe('Route config/getConfig', () => { }) it('returns value of the requested ConfigOptions', async () => { - const response = await routeTest.client - .request('config/getConfig', { - name: 'minerBatchSize', - }) - .waitForEnd() + const response = await routeTest.client.config.getConfig({ + name: 'minerBatchSize', + }) expect(response.status).toBe(200) expect(response.content).toEqual({ minerBatchSize: routeTest.node.config.get('minerBatchSize'), @@ -24,12 +22,10 @@ describe('Route config/getConfig', () => { it('returns nothing when no datadir exists', async () => { const target = {} - const response = await routeTest.client - .request('config/getConfig', { - name: 'minerBatchSize', - user: true, - }) - .waitForEnd() + const response = await routeTest.client.config.getConfig({ + name: 'minerBatchSize', + user: true, + }) expect(response.status).toBe(200) expect(response.content).toEqual(target) }) diff --git a/ironfish/src/rpc/routes/config/setConfig.test.ts b/ironfish/src/rpc/routes/config/setConfig.test.ts index 86affdfb45..068f9f4eb1 100644 --- a/ironfish/src/rpc/routes/config/setConfig.test.ts +++ b/ironfish/src/rpc/routes/config/setConfig.test.ts @@ -10,36 +10,28 @@ describe('Route config/setConfig', () => { it('should error if the config name does not exist', async () => { await expect( - routeTest.client - .request('config/setConfig', { name: 'asdf', value: 'asdf' }) - .waitForEnd(), + routeTest.client.config.setConfig({ name: 'asdf', value: 'asdf' }), ).rejects.toThrow() }) describe('Convert string to array', () => { it('does not special-case brackets', async () => { - const response = await routeTest.client - .request('config/setConfig', { - name: 'bootstrapNodes', - value: '[]', - }) - .waitForEnd() - const content = await response.content + const response = await routeTest.client.config.setConfig({ + name: 'bootstrapNodes', + value: '[]', + }) expect(response.status).toBe(200) - expect(content).toBeUndefined() + expect(response.content).toBeUndefined() expect(routeTest.sdk.config.get('bootstrapNodes')).toEqual(['[]']) }) it('should convert strings to arrays', async () => { - const response = await routeTest.client - .request('config/setConfig', { - name: 'bootstrapNodes', - value: 'test.node.com,test2.node.com', - }) - .waitForEnd() - const content = await response.content + const response = await routeTest.client.config.setConfig({ + name: 'bootstrapNodes', + value: 'test.node.com,test2.node.com', + }) expect(response.status).toBe(200) - expect(content).toBeUndefined() + expect(response.content).toBeUndefined() expect(routeTest.sdk.config.get('bootstrapNodes')).toEqual([ 'test.node.com', 'test2.node.com', @@ -47,41 +39,32 @@ describe('Route config/setConfig', () => { }) it('handles single values', async () => { - const response = await routeTest.client - .request('config/setConfig', { - name: 'bootstrapNodes', - value: 'test.node.com', - }) - .waitForEnd() - const content = await response.content + const response = await routeTest.client.config.setConfig({ + name: 'bootstrapNodes', + value: 'test.node.com', + }) expect(response.status).toBe(200) - expect(content).toBeUndefined() + expect(response.content).toBeUndefined() expect(routeTest.sdk.config.get('bootstrapNodes')).toEqual(['test.node.com']) }) it('should strip leading and trailing whitespace', async () => { - const response = await routeTest.client - .request('config/setConfig', { - name: 'bootstrapNodes', - value: ' node1 , node2 ', - }) - .waitForEnd() - const content = await response.content + const response = await routeTest.client.config.setConfig({ + name: 'bootstrapNodes', + value: ' node1 , node2 ', + }) expect(response.status).toBe(200) - expect(content).toBeUndefined() + expect(response.content).toBeUndefined() expect(routeTest.sdk.config.get('bootstrapNodes')).toEqual(['node1', 'node2']) }) it('should leave quotes', async () => { - const response = await routeTest.client - .request('config/setConfig', { - name: 'bootstrapNodes', - value: ' \' node1 \' , " node2 " ', - }) - .waitForEnd() - const content = await response.content + const response = await routeTest.client.config.setConfig({ + name: 'bootstrapNodes', + value: ' \' node1 \' , " node2 " ', + }) expect(response.status).toBe(200) - expect(content).toBeUndefined() + expect(response.content).toBeUndefined() expect(routeTest.sdk.config.get('bootstrapNodes')).toEqual(["' node1 '", '" node2 "']) }) }) diff --git a/ironfish/src/rpc/routes/wallet/multisig/createTrustedDealerKeyPackage.test.ts b/ironfish/src/rpc/routes/wallet/multisig/createTrustedDealerKeyPackage.test.ts index 5f11952eb7..afcca6a950 100644 --- a/ironfish/src/rpc/routes/wallet/multisig/createTrustedDealerKeyPackage.test.ts +++ b/ironfish/src/rpc/routes/wallet/multisig/createTrustedDealerKeyPackage.test.ts @@ -12,9 +12,9 @@ describe('Route multisig/createTrustedDealerKeyPackage', () => { identity: multisig.ParticipantSecret.random().toIdentity().serialize().toString('hex'), })) const request = { minSigners: 2, participants } - const response = await routeTest.client - .request('wallet/multisig/createTrustedDealerKeyPackage', request) - .waitForEnd() + const response = await routeTest.client.wallet.multisig.createTrustedDealerKeyPackage( + request, + ) expect(response.content).toMatchObject({ publicAddress: expect.any(String), diff --git a/ironfish/src/rpc/routes/worker/getStatus.test.ts b/ironfish/src/rpc/routes/worker/getStatus.test.ts index 3e6019a2e6..f2234ef195 100644 --- a/ironfish/src/rpc/routes/worker/getStatus.test.ts +++ b/ironfish/src/rpc/routes/worker/getStatus.test.ts @@ -9,9 +9,7 @@ describe('Route worker/getStatus', () => { it('should get status', async () => { const request: GetWorkersStatusRequest = { stream: false } - const response = await routeTest.client - .request('worker/getStatus', { request }) - .waitForEnd() + const response = await routeTest.client.worker.getWorkersStatus(request) expect(response.status).toBe(200)