Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix challenge.test.ts #177

Merged
merged 2 commits into from
Dec 15, 2023
Merged

Conversation

nkongsuwan
Copy link
Contributor

When I ran challenge.test.ts locally using

TEST_ENVIRONMENT=local npx jest examples/integration-scripts/challenge.test.ts

I encountered the following error

 FAIL  examples/integration-scripts/challenge.test.ts (9.743 s)
  ✕ challenge (8165 ms)

  ● challenge

    expect(received).toEqual(expected) // deep equality

    Expected: "bob"
    Received: "Wan"

      93 |     // List Client 1 contacts
      94 |     let contacts1 = await client1.contacts().list();
    > 95 |     expect(contacts1[0].alias).toEqual('bob');
         |                                ^
      96 |     expect(contacts1[0].challenges).toHaveLength(0);
      97 |
      98 |     // Bob responds to Alice challenge

      at Object.<anonymous> (challenge.test.ts:95:32)

contacts1[0] points to a witness instead of bob. I assume that this test passed the automatic test, so I guess the order of elements in contacts is somehow different in the automatic test. Hence, I added a function findContact() and a variable bobContact = findContact(contacts1, 'bob') to avoid this error.

Copy link

codecov bot commented Dec 10, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (421232d) 81.42% compared to head (d421454) 81.42%.

Additional details and impacted files
@@             Coverage Diff              @@
##           development     #177   +/-   ##
============================================
  Coverage        81.42%   81.42%           
============================================
  Files               46       46           
  Lines             4141     4141           
  Branches          1030     1030           
============================================
  Hits              3372     3372           
  Misses             737      737           
  Partials            32       32           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@psteniusubi
Copy link
Contributor

Hi @nkongsuwan.

Looks good to me. You can also lookup contacts by alias if you wish

    const list = await client.contacts().list(undefined, 'alias', `^${name}$`);

The root cause for the test failing is that there are still some unexpected differences with local and docker environment. This one is caused by differences in https://github.com/WebOfTrust/signify-ts/blob/development/config/keria.json and https://github.com/WebOfTrust/keria/blob/development/scripts/keri/cf/demo-witness-oobis.json

The second Keria config associates witness endpoints with contact alias names "Wan", "Wes" and "Wil".

I'm creating an other PR to fix differences with local and docker environments.

nkongsuwan and others added 2 commits December 15, 2023 09:09
Signed-off-by: Nuttawut Kongsuwan <[email protected]>

Signed-off-by: Nuttawut Kongsuwan <[email protected]>

Signed-off-by: Nuttawut Kongsuwan <[email protected]>
@lenkan lenkan self-requested a review December 15, 2023 11:14
@lenkan lenkan merged commit a541d94 into WebOfTrust:development Dec 15, 2023
6 checks passed
@nkongsuwan nkongsuwan deleted the fix-challenge-test branch January 24, 2024 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants