This repository has been archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
50d63c6
commit c7183bf
Showing
3 changed files
with
18 additions
and
14 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,21 +1,25 @@ | ||
import { Web3RegistryClient } from "../Web3RegistryClient"; | ||
import { getRegistry } from "../getRegistry"; | ||
import { Peers } from './../../peer/Peers'; | ||
import { Peers } from '../../peer/Peers'; | ||
|
||
jest.mock('./../Web3RegistryClient'); | ||
jest.mock('../Web3RegistryClient'); | ||
|
||
describe("getRegistry", () => { | ||
let fakeWebRegistryClient: Partial<Web3RegistryClient>; | ||
|
||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
test("Conf is not complete", () => { | ||
expect(getRegistry({}, {} as Peers, [])).toBe(null); | ||
expect(getRegistry({ NETWORK: "rinkeby" }, {} as Peers, [])).toBe(null); | ||
expect(getRegistry({ API_KEY: "infura"}, {} as Peers, [])).toBe(null); | ||
test("Conf is not complete", async () => { | ||
expect(await getRegistry({}, {} as Peers, [])).toBe(null); | ||
expect(await getRegistry({ NETWORK: "rinkeby" }, {} as Peers, [])).toBe(null); | ||
expect(await getRegistry({ API_KEY: "infura"}, {} as Peers, [5])).toBe(null); | ||
}); | ||
|
||
test("ok smart contract", () => { | ||
const newLocal = getRegistry({ API_KEY: "infura", NETWORK: "rinkeby" }, {} as Peers, []); | ||
expect(newLocal!.constructor.name).toBe("Web3RegistryClient"); | ||
test("ok smart contract", async () => { | ||
const registry = await getRegistry({ API_KEY: "infura", NETWORK: "rinkeby" }, {} as Peers, [5]); | ||
expect(registry!.constructor.name).toBe("Web3RegistryClient"); | ||
expect(registry!.connect).toHaveBeenCalledWith(5) | ||
}); | ||
}); |
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