forked from starknet-io/starknet.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
73 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
import { RPC07 } from '../src'; | ||
import { RPC06, RPC07 } from '../src'; | ||
import { createBlockForDevnet, getTestProvider } from './config/fixtures'; | ||
import { initializeMatcher } from './config/schema'; | ||
|
||
describe('RPC 0.7.0', () => { | ||
const rpcProvider = getTestProvider(false); | ||
const channel = rpcProvider.channel as RPC07.RpcChannel; | ||
describe('RpcChannel', () => { | ||
const { nodeUrl } = getTestProvider(false).channel; | ||
const channel07 = new RPC07.RpcChannel({ nodeUrl }); | ||
initializeMatcher(expect); | ||
|
||
beforeAll(async () => { | ||
await createBlockForDevnet(); | ||
}); | ||
|
||
test('getBlockWithReceipts', async () => { | ||
const response = await channel.getBlockWithReceipts('latest'); | ||
expect(response).toMatchSchemaRef('BlockWithTxReceipts'); | ||
test('baseFetch override', async () => { | ||
const baseFetch = jest.fn(); | ||
const fetchChannel06 = new RPC06.RpcChannel({ nodeUrl, baseFetch }); | ||
const fetchChannel07 = new RPC07.RpcChannel({ nodeUrl, baseFetch }); | ||
(fetchChannel06.fetch as any)(); | ||
expect(baseFetch).toHaveBeenCalledTimes(1); | ||
baseFetch.mockClear(); | ||
(fetchChannel07.fetch as any)(); | ||
expect(baseFetch).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
describe('RPC 0.7.0', () => { | ||
test('getBlockWithReceipts', async () => { | ||
const response = await channel07.getBlockWithReceipts('latest'); | ||
expect(response).toMatchSchemaRef('BlockWithTxReceipts'); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters