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: 3/5 tests failed for createTask.test.ts #17

Closed
chrisli30 opened this issue Nov 1, 2024 · 2 comments
Closed

Test failure: 3/5 tests failed for createTask.test.ts #17

chrisli30 opened this issue Nov 1, 2024 · 2 comments
Labels
P1 Priority 1 testing Test cases related issue

Comments

@chrisli30
Copy link
Member

Expected Behavior

  1. Task creation with owner address should fail with "invalid address" error (both API key and signature auth)
  2. Task creation with smart wallet should succeed when using API key auth

Current Behavior

Three tests are failing with different issues:

  1. Signature Auth + Owner Address

    • Expected: Should reject with "invalid address"
    • Actual: Successfully creates task with ID "29015"
  2. API Key Auth + Smart Wallet

    • Expected: Should successfully create task
    • Actual: Fails with "1 CANCELLED: Call cancelled"
  3. API Key Auth + Owner Address

    • Expected: Should reject with "invalid address"
    • Actual: Fails with "1 CANCELLED: Call cancelled"

Test Details

// Test 1 - Incorrectly succeeding
test("should fail when creating a task with owner address using signature", async () => {
  await expect(
    client.createTask({
      address: ownerAddress,
      tokenContract: TOKEN_CONTRACT,
      oracleContract: ORACLE_CONTRACT,
    })
  ).rejects.toThrow("invalid address");
});

// Test 2 - Failing with cancellation
test("should create a task when authenticated with API key", async () => {
  const result = await client.createTask({
    address: smartWallet,
    tokenContract: TOKEN_CONTRACT,
    oracleContract: ORACLE_CONTRACT,
  });
  expect(result).toBeDefined();
});

// Test 3 - Wrong error type
test("should fail when creating a task with owner address using API key", 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
    ✓ should throw error when creating a task without authentication (1178 ms)
    Auth with Signature
      ✓ should create a task when authenticated with signature (285 ms)
      ✕ should fail when creating a task with owner address using signature (259 ms)
    Auth with API key
      ✕ should create a task when authenticated with API key (161 ms)
      ✕ should fail when creating a task with owner address using API key (1250 ms)

Reproduction Steps

  1. Run npx jest tests/createTask.test.ts
  2. Observe multiple failures with inconsistent behaviors

Additional Context

  • API key authentication seems to have connection issues (CANCELLED errors)
  • Address validation is not working as expected with signature authentication
  • The system needs consistent behavior for owner address rejection across both auth methods
@chrisli30 chrisli30 added P1 Priority 1 testing Test cases related issue labels Nov 1, 2024
@chrisli30 chrisli30 changed the title Critical: Task creation tests failing with inconsistent behaviors Test failure: 3/5 tests failed for createTask.test.ts Nov 1, 2024
@v9n
Copy link
Member

v9n commented Nov 8, 2024

I realized the owner term you used are different from mine. So want to agree on the term.

Previous behavior:

  • owner of a task is the original EOA. The address is derive directly from the signatur. There is no way to set the owner.
  • the smart wallet address is auto generate with the salt=0.

New behavior in our code:

  • owner: this will be the smart wallet address. This address we allow end user to set it to a smart wallet of their choice.
  • creator: This cannot be set when creating a task. It's the EOA address of the person who create the above smart wallet, and setup the task.

Let me know if this term sounds good to you.

@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
P1 Priority 1 testing Test cases related issue
Projects
None yet
Development

No branches or pull requests

2 participants