Skip to content

Commit

Permalink
fix & add batch tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kziemianek committed Jul 19, 2023
1 parent 87d4e9a commit 375c5cb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
9 changes: 8 additions & 1 deletion tee-worker/ts-tests/integration-tests/batch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { LitentryPrimitivesIdentity } from 'sidechain-api';
import type { LitentryValidationData, Web3Network } from 'parachain-api';

describeLitentry('Test Batch Utility', 0, (context) => {
const identities: LitentryPrimitivesIdentity[] = [];
let identities: LitentryPrimitivesIdentity[] = [];
let validations: LitentryValidationData[] = [];
let ethereumSigners: ethers.Wallet[] = [];
const we3networks: Web3Network[][] = [];
Expand Down Expand Up @@ -99,6 +99,13 @@ describeLitentry('Test Batch Utility', 0, (context) => {
});

step('batch test: deactivate error identities', async function () {
identities = [];
// prepare new identities that were not linked - so they do not exist
for (let index = 0; index < ethereumSigners.length; index++) {
const ethereumIdentity = await buildIdentityHelper('twitter_user_' + index, 'Twitter', context);
identities.push(ethereumIdentity);
}

const txs = await buildIdentityTxs(context, context.substrateWallet.alice, identities, 'deactivateIdentity');
const deactivatedEvents = await sendTxsWithUtility(
context,
Expand Down
11 changes: 0 additions & 11 deletions tee-worker/ts-tests/integration-tests/common/utils/assertion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,6 @@ export async function assertIdentityDeactivated(
const eventData = events[index].data;
const who = eventData.account.toHex();

// Check idGraph
assert.isNull(
eventData.idGraph,
'check IdentityDeactivated error: event idGraph should be null after identity deactivated'
);

assert.equal(
who,
u8aToHex(signer.addressRaw),
Expand All @@ -162,11 +156,6 @@ export async function assertIdentityActivated(
const eventData = events[index].data;
const who = eventData.account.toHex();

// Check idGraph
assert.isNotNull(
eventData.idGraph,
'check IdentityActivated error: event idGraph should not be null after identity deactivated'
);
assert.equal(who, u8aToHex(signer.addressRaw), 'Check IdentityActivated error: signer should be equal to who');
}

Expand Down

0 comments on commit 375c5cb

Please sign in to comment.