Skip to content

Commit

Permalink
update with @lenkan suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
nkongsuwan committed Dec 15, 2023
1 parent f52afaf commit d421454
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions examples/integration-scripts/challenge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ test('challenge', async () => {

// List Client 1 contacts
let contacts1 = await client1.contacts().list();
let bobContact = findContact(contacts1, 'bob');
let bobContact = contacts1.find(
(contact: { alias: string }) => contact.alias === 'bob'
);
expect(bobContact.alias).toEqual('bob');
expect(bobContact.challenges).toHaveLength(0);

Expand Down Expand Up @@ -120,16 +122,8 @@ test('challenge', async () => {

// Check Bob's challenge in conctats
contacts1 = await client1.contacts().list();
bobContact = findContact(contacts1, 'bob');
bobContact = contacts1.find(
(contact: { alias: string }) => contact.alias === 'bob'
);
expect(bobContact.challenges[0].authenticated).toEqual(true);
}, 30000);

function findContact(contactsList: any, name: any) {
let contact: any;
for (const index in contactsList) {
if (contactsList[index].alias == name) {
contact = contactsList[index];
}
}
return contact;
}

0 comments on commit d421454

Please sign in to comment.