-
Notifications
You must be signed in to change notification settings - Fork 117
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
12 changed files
with
15,111 additions
and
1,200 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
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,37 +1,25 @@ | ||
import { CONFIGS } from "./config"; | ||
import { commonCases, limaCases } from './data/allTestsCases'; | ||
import { commonCases } from './data/allTestsCases'; | ||
import { LocalForger, ProtocolsHash } from '@taquito/local-forging' | ||
import { TezosToolkit } from "@taquito/taquito"; | ||
|
||
CONFIGS().forEach(({ rpc, protocol }) => { | ||
const Tezos = new TezosToolkit(rpc); | ||
const Tezos = new TezosToolkit(rpc); | ||
|
||
describe(`Test local forger: ${rpc}`, () => { | ||
describe(`Test local forger: ${rpc}`, () => { | ||
|
||
// all protocols | ||
commonCases.forEach(({ name, operation, expected }) => { | ||
// all protocols | ||
commonCases.forEach(({ name, operation, expected }) => { | ||
it(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async done => { | ||
const localForger = new LocalForger(protocol as unknown as ProtocolsHash); | ||
|
||
it(`Verify that .forge for local forge will return same result as for network forge for rpc: ${name} (${rpc})`, async done => { | ||
const localForger = new LocalForger(protocol as unknown as ProtocolsHash); | ||
const result = await localForger.forge(operation); | ||
const rpcResult = await Tezos.rpc.forgeOperations(operation); | ||
expect(result).toEqual(rpcResult); | ||
expect(await localForger.parse(result)).toEqual(expected || operation); | ||
|
||
const result = await localForger.forge(operation); | ||
const rpcResult = await Tezos.rpc.forgeOperations(operation); | ||
expect(result).toEqual(rpcResult); | ||
expect(await localForger.parse(result)).toEqual(expected || operation); | ||
|
||
done(); | ||
}); | ||
}); | ||
|
||
limaCases.forEach(({ name, operation, expected }) => { | ||
it(`Should give the same result as when forging with the rpc: ${name} (${rpc})`, async done => { | ||
const localForger = new LocalForger(protocol as unknown as ProtocolsHash); | ||
const result = await localForger.forge(operation); | ||
const rpcResult = await Tezos.rpc.forgeOperations(operation); | ||
expect(result).toEqual(rpcResult); | ||
expect(await localForger.parse(result)).toEqual(expected || operation); | ||
done(); | ||
}); | ||
}); | ||
done(); | ||
}); | ||
}); | ||
}) | ||
}); | ||
}); |
Oops, something went wrong.