Expect null if bond or authority is not found #6

Merged
nabarun merged 2 commits from nv-handle-error into main 2024-03-12 08:40:47 +00:00
Member
Part of https://www.notion.so/Create-laconic-registry-SDK-d3a636d4aba44f7cbba3bd99b7146811
prathamesh added 1 commit 2024-03-12 06:38:49 +00:00
prathamesh added 1 commit 2024-03-12 07:16:01 +00:00
Member

Tests output:

yarn test
yarn run v1.22.19
$ jest --runInBand --verbose --testPathPattern=src
 PASS  src/naming.test.ts (100.198 s)
  Naming
    Authority tests
      ✓ Reserve authority. (3107 ms)
      With authority reserved
        ✓ Lookup authority. (7 ms)
        ✓ Lookup non existing authority (3 ms)
        ✓ Reserve already reserved authority (3115 ms)
        ✓ Reserve sub-authority. (3110 ms)
        ✓ Reserve sub-authority with different owner. (9492 ms)
        ✓ Set name for unbonded authority (3116 ms)
        ✓ Set authority bond (3107 ms)
    Naming tests
      ✓ Set name (6234 ms)
      ✓ Set name without reserving authority (3109 ms)
      ✓ Set name for non-owned authority (9332 ms)
      ✓ Delete name for non-owned authority. (12486 ms)
      ✓ Lookup non existing name (5 ms)
      ✓ Resolve non existing name (4 ms)
      With name set
        ✓ Lookup name (5 ms)
        ✓ Resolve name (7 ms)
        ✓ Lookup name with history (6288 ms)
        ✓ Delete name (3121 ms)
        ✓ Delete already deleted name (6217 ms)

 PASS  src/bond.test.ts (44.331 s)
  Bonds
    ✓ Create bond. (3164 ms)
    ✓ Associate/Dissociate bond. (12568 ms)
    ✓ Reassociate/Dissociate records. (15741 ms)
    With bond created
      ✓ Get bond by ID. (4 ms)
      ✓ Query bonds. (3 ms)
      ✓ Query bonds by owner. (3 ms)
      ✓ Refill bond. (3106 ms)
      ✓ Withdraw bond. (3120 ms)
      ✓ Cancel bond. (3112 ms)

 PASS  src/auction.test.ts
  ✓ skipping auction tests (1 ms)

 PASS  src/nameservice-expiry.test.ts
  ✓ skipping nameservice expiry tests

 PASS  src/sdk.test.ts (6.622 s)
  Querying
    ✓ Endpoint and chain ID. (2 ms)
    ✓ Get status. (10 ms)
    ✓ List records. (10 ms)
    ✓ Query records by reference. (8 ms)
    ✓ Query records by attributes. (2 ms)
    ✓ Query records by id. (2 ms)
    ✓ Query records passing refs true. (4 ms)

 PASS  src/index.test.ts
  Registry
    ✓ Get account info. (66 ms)
    ✓ Get account balance. (3221 ms)

 PASS  src/util.test.ts (6.59 s)
  Util
    ✓ Generate content id. (7 ms)

Test Suites: 7 passed, 7 total
Tests:       40 passed, 40 total
Snapshots:   0 total
Time:        161.901 s
Ran all test suites matching /src/i.
Done in 162.30s.

Auctions enabled test output:

yarn test:auctions
yarn run v1.22.19
$ TEST_AUCTIONS_ENABLED=1 jest --runInBand --verbose src/auction.test.ts
  console.log
    Running auction tests with num bidders 1

      at src/auction.test.ts:17:13

  console.log
    Running auction tests with num bidders 2

      at src/auction.test.ts:17:13

  console.log
    Running auction tests with num bidders 4

      at src/auction.test.ts:17:13

 PASS  src/auction.test.ts (440.286 s)
  Auction (1 bidder)
    ✓ Setup bidder accounts (3238 ms)
    ✓ Reserve authority. (3114 ms)
    ✓ Authority should be under auction. (21 ms)
    ✓ Commit bids. (3116 ms)
    ✓ Check bids are committed (5 ms)
    ✓ Wait for reveal phase. (60002 ms)
    ✓ Reveal bids. (3121 ms)
    ✓ Check bids are revealed (4 ms)
    ✓ Wait for auction completion. (60001 ms)
    ✓ Check auction winner, authority owner and status. (12 ms)
  Auction (2 bidders)
    ✓ Setup bidder accounts (6358 ms)
    ✓ Reserve authority. (3109 ms)
    ✓ Authority should be under auction. (8 ms)
    ✓ Commit bids. (6219 ms)
    ✓ Check bids are committed (7 ms)
    ✓ Wait for reveal phase. (60001 ms)
    ✓ Reveal bids. (6216 ms)
    ✓ Check bids are revealed (9 ms)
    ✓ Wait for auction completion. (60001 ms)
    ✓ Check auction winner, authority owner and status. (14 ms)
  Auction (4 bidders)
    ✓ Setup bidder accounts (12695 ms)
    ✓ Reserve authority. (3108 ms)
    ✓ Authority should be under auction. (13 ms)
    ✓ Commit bids. (15432 ms)
    ✓ Check bids are committed (7 ms)
    ✓ Wait for reveal phase. (60000 ms)
    ✓ Reveal bids. (12446 ms)
    ✓ Check bids are revealed (4 ms)
    ✓ Wait for auction completion. (60002 ms)
    ✓ Check auction winner, authority owner and status. (10 ms)

Test Suites: 1 passed, 1 total
Tests:       30 passed, 30 total
Snapshots:   0 total
Time:        440.314 s
Ran all test suites matching /src\/auction.test.ts/i.
Done in 440.68s.

Record and authority expiry tests output

yarn test:nameservice-expiry
yarn run v1.22.19
$ TEST_NAMESERVICE_EXPIRY=1 jest --runInBand --verbose src/nameservice-expiry.test.ts
 PASS  src/nameservice-expiry.test.ts (134.602 s)
  Nameservice Expiry
    ✓ Set record and check bond balance (3194 ms)
    ✓ Reserve authority and set bond (6209 ms)
    ✓ Wait for expiry duration (60002 ms)
    ✓ Check record expiry time (12 ms)
    ✓ Check authority expiry time (3 ms)
    ✓ Check bond balance (8 ms)
    ✓ Wait for expiry duration (60002 ms)
    ✓ Check record deleted without bond balance (6 ms)
    ✓ Check authority expired without bond balance (3 ms)

Test Suites: 1 passed, 1 total
Tests:       9 passed, 9 total
Snapshots:   0 total
Time:        134.628 s
Ran all test suites matching /src\/nameservice-expiry.test.ts/i.
Done in 134.98s.
Tests output: ```bash yarn test yarn run v1.22.19 $ jest --runInBand --verbose --testPathPattern=src PASS src/naming.test.ts (100.198 s) Naming Authority tests ✓ Reserve authority. (3107 ms) With authority reserved ✓ Lookup authority. (7 ms) ✓ Lookup non existing authority (3 ms) ✓ Reserve already reserved authority (3115 ms) ✓ Reserve sub-authority. (3110 ms) ✓ Reserve sub-authority with different owner. (9492 ms) ✓ Set name for unbonded authority (3116 ms) ✓ Set authority bond (3107 ms) Naming tests ✓ Set name (6234 ms) ✓ Set name without reserving authority (3109 ms) ✓ Set name for non-owned authority (9332 ms) ✓ Delete name for non-owned authority. (12486 ms) ✓ Lookup non existing name (5 ms) ✓ Resolve non existing name (4 ms) With name set ✓ Lookup name (5 ms) ✓ Resolve name (7 ms) ✓ Lookup name with history (6288 ms) ✓ Delete name (3121 ms) ✓ Delete already deleted name (6217 ms) PASS src/bond.test.ts (44.331 s) Bonds ✓ Create bond. (3164 ms) ✓ Associate/Dissociate bond. (12568 ms) ✓ Reassociate/Dissociate records. (15741 ms) With bond created ✓ Get bond by ID. (4 ms) ✓ Query bonds. (3 ms) ✓ Query bonds by owner. (3 ms) ✓ Refill bond. (3106 ms) ✓ Withdraw bond. (3120 ms) ✓ Cancel bond. (3112 ms) PASS src/auction.test.ts ✓ skipping auction tests (1 ms) PASS src/nameservice-expiry.test.ts ✓ skipping nameservice expiry tests PASS src/sdk.test.ts (6.622 s) Querying ✓ Endpoint and chain ID. (2 ms) ✓ Get status. (10 ms) ✓ List records. (10 ms) ✓ Query records by reference. (8 ms) ✓ Query records by attributes. (2 ms) ✓ Query records by id. (2 ms) ✓ Query records passing refs true. (4 ms) PASS src/index.test.ts Registry ✓ Get account info. (66 ms) ✓ Get account balance. (3221 ms) PASS src/util.test.ts (6.59 s) Util ✓ Generate content id. (7 ms) Test Suites: 7 passed, 7 total Tests: 40 passed, 40 total Snapshots: 0 total Time: 161.901 s Ran all test suites matching /src/i. Done in 162.30s. ``` Auctions enabled test output: ```bash yarn test:auctions yarn run v1.22.19 $ TEST_AUCTIONS_ENABLED=1 jest --runInBand --verbose src/auction.test.ts console.log Running auction tests with num bidders 1 at src/auction.test.ts:17:13 console.log Running auction tests with num bidders 2 at src/auction.test.ts:17:13 console.log Running auction tests with num bidders 4 at src/auction.test.ts:17:13 PASS src/auction.test.ts (440.286 s) Auction (1 bidder) ✓ Setup bidder accounts (3238 ms) ✓ Reserve authority. (3114 ms) ✓ Authority should be under auction. (21 ms) ✓ Commit bids. (3116 ms) ✓ Check bids are committed (5 ms) ✓ Wait for reveal phase. (60002 ms) ✓ Reveal bids. (3121 ms) ✓ Check bids are revealed (4 ms) ✓ Wait for auction completion. (60001 ms) ✓ Check auction winner, authority owner and status. (12 ms) Auction (2 bidders) ✓ Setup bidder accounts (6358 ms) ✓ Reserve authority. (3109 ms) ✓ Authority should be under auction. (8 ms) ✓ Commit bids. (6219 ms) ✓ Check bids are committed (7 ms) ✓ Wait for reveal phase. (60001 ms) ✓ Reveal bids. (6216 ms) ✓ Check bids are revealed (9 ms) ✓ Wait for auction completion. (60001 ms) ✓ Check auction winner, authority owner and status. (14 ms) Auction (4 bidders) ✓ Setup bidder accounts (12695 ms) ✓ Reserve authority. (3108 ms) ✓ Authority should be under auction. (13 ms) ✓ Commit bids. (15432 ms) ✓ Check bids are committed (7 ms) ✓ Wait for reveal phase. (60000 ms) ✓ Reveal bids. (12446 ms) ✓ Check bids are revealed (4 ms) ✓ Wait for auction completion. (60002 ms) ✓ Check auction winner, authority owner and status. (10 ms) Test Suites: 1 passed, 1 total Tests: 30 passed, 30 total Snapshots: 0 total Time: 440.314 s Ran all test suites matching /src\/auction.test.ts/i. Done in 440.68s. ``` Record and authority expiry tests output ```bash yarn test:nameservice-expiry yarn run v1.22.19 $ TEST_NAMESERVICE_EXPIRY=1 jest --runInBand --verbose src/nameservice-expiry.test.ts PASS src/nameservice-expiry.test.ts (134.602 s) Nameservice Expiry ✓ Set record and check bond balance (3194 ms) ✓ Reserve authority and set bond (6209 ms) ✓ Wait for expiry duration (60002 ms) ✓ Check record expiry time (12 ms) ✓ Check authority expiry time (3 ms) ✓ Check bond balance (8 ms) ✓ Wait for expiry duration (60002 ms) ✓ Check record deleted without bond balance (6 ms) ✓ Check authority expired without bond balance (3 ms) Test Suites: 1 passed, 1 total Tests: 9 passed, 9 total Snapshots: 0 total Time: 134.628 s Ran all test suites matching /src\/nameservice-expiry.test.ts/i. Done in 134.98s. ```
nabarun merged commit 4e5f9bf9e1 into main 2024-03-12 08:40:47 +00:00
nabarun deleted branch nv-handle-error 2024-03-12 08:40:47 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/registry-sdk#6
No description provided.