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

Test Failure: should fail when creating a task with owner address using signature #11

Closed
chrisli30 opened this issue Nov 1, 2024 · 1 comment
Labels
P2 Priority 2 testing Test cases related issue

Comments

@chrisli30
Copy link
Member

chrisli30 commented Nov 1, 2024

Expected Behavior

  • The API should reject task creation when using an owner address instead of a smart wallet address
  • Should throw an "invalid address" error

Current Behavior

  • Instead, the API successfully creates a task and returns an ID ({"id": "10017"})

Test Details

test("should fail when create a wallet with owner address", async () => {
  await expect(client.createTask({
    address: ownerAddress,
    tokenContract: TOKEN_CONTRACT,
    oracleContract: ORACLE_CONTRACT,
  })).rejects.toThrow(
    "invalid address"
  );
});

Test Trace

 FAIL  tests/createTask.test.ts
  listTasks Tests
    ○ skipped should throw error when creating a task without authentication
    Auth with Signature
      ✕ should fail when creating a task with owner address using signature (448 ms)
      ○ skipped should create a task when authenticated with signature
    Auth with API key
      ○ skipped should create a task when authenticated with API key
      ○ skipped should fail when creating a task with owner address using API key

  ● listTasks Tests › Auth with Signature › should fail when creating a task with owner address using signature

    expect(received).rejects.toThrow()

    Received promise resolved instead of rejected
    Resolved to value: {"id": "21014"}

      64 |
      65 |     test("should fail when creating a task with owner address using signature", async () => {
    > 66 |       await expect(
         |                   ^
      67 |         client.createTask({
      68 |           address: ownerAddress,
      69 |           tokenContract: TOKEN_CONTRACT,

      at expect (node_modules/expect/build/index.js:113:15)
      at Object.<anonymous> (tests/createTask.test.ts:66:19)

Test Suites: 1 failed, 1 total
Tests:       1 failed, 4 skipped, 5 total
Snapshots:   0 total
Time:        1.537 s, estimated 3 s

Reproduction Steps

  1. Run npx jest tests/createTask.test.ts -t "should fail when creating a task with owner address using signature"
  2. Observe that creating a task with owner address succeeds instead of failing

Additional Context

  • This might indicate that the API's address validation is not properly checking whether the provided address is a smart wallet
  • The test name suggests we want to enforce using smart wallet addresses only
@chrisli30 chrisli30 added bug Something isn't working testing Test cases related issue P2 Priority 2 and removed bug Something isn't working labels Nov 1, 2024
@chrisli30 chrisli30 changed the title Test Failure: Creating Task with Owner Address Should Fail but Succeeds Test Failure: should fail when creating a task with owner address using signature Nov 1, 2024
@v9n
Copy link
Member

v9n commented Nov 21, 2024

Fixed in #30

@v9n v9n closed this as completed Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Priority 2 testing Test cases related issue
Projects
None yet
Development

No branches or pull requests

2 participants