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

add tests for add, query, update, delete #18

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

euledge
Copy link
Contributor

@euledge euledge commented Sep 8, 2023

Resolved Issues

Reference Issue

#9

Details of Changes

  • Adds Collection Items
  • Get Collection Item
  • Query Collection Items
  • Update Collection Item
  • Delete Collection Item

Please review

Query testing is unstable

Testing for Query simple conditions is not stable and may result in success or error.
Allways Testing for Query advanced conditions is not success

 FAIL  tests/firestore_spec.test.ts (11.316 s)
  ● Query Collection Items › should get item from the database using the simple conditions

    expect(received).toBe(expected) // Object.is equality

    Expected: 1
    Received: 0

      150 |     const usersByAge = await queryCollectionItems<User>(db, path, simpleConditions)
      151 |
    > 152 |     expect(usersByAge.length).toBe(1)
          |                               ^
      153 |     expect(usersByAge[0].name).toBe('John Doe')
      154 |   })
      155 |

      at Object.<anonymous> (tests/firestore_spec.test.ts:152:31)

  ● Query Collection Items › should get item from the database using the advanced conditions

    Error querying collection: Error: 3 INVALID_ARGUMENT: inequality filter property and first sort order must be the same: age and name

      108 |     }))
      109 |   } catch (error) {
    > 110 |     throw new Error(`Error querying collection: ${error}`)
          |           ^
      111 |   }
      112 | }
      113 |

      at queryCollectionItems (src/lib/queryCollectionItems.ts:110:11)
      at Object.<anonymous> (tests/firestore_spec.test.ts:175:24)

Delete testing

delete for a non-existing document is success, don't raise exception.

See. https://googleapis.dev/nodejs/firestore/latest/DocumentReference.html#delete

@KishiTheMechanic KishiTheMechanic merged commit 281cd88 into elsoul:main Sep 8, 2023
1 check failed
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.

add test methods for adds, query, update, delete
2 participants