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

🚀 Feature: Partial Postgres queries assertions #35

Open
1 task done
nirga opened this issue Feb 26, 2023 · 0 comments
Open
1 task done

🚀 Feature: Partial Postgres queries assertions #35

nirga opened this issue Feb 26, 2023 · 0 comments
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@nirga
Copy link
Member

nirga commented Feb 26, 2023

🔖 Feature description

Our Postgres assertions can only validate exact queries.
So, for example, you can validate that a query like INSERT INTO users(email) VALUES ([email protected]).
The downside of this is that you need to specify the exact query that was made on the database.

But usually, you don't really want to validate the entire query syntax, you just want to validate that some fields were added to the table, but you don't care about the others.

This feature should allow writing an assertion like

expectTrace(traceloop)
  .toQueryPostgresSQL()
  .withPartialQuery(
    `INSERT INTO users(email) VALUES ([email protected])`

And it will succeed even if the actual query was
INSERT INTO users(name, request_id, email) VALUES (bla, 5934345, [email protected])

🎤 Why is this feature needed ?

Our goal with this project is to make end-to-end tests easier. Being able to write simple assertions Is core to this.

✌️ How do you aim to achieve this?

We will need to use some Typescript SQL parser to parse and compare the asserted and actual SQL queries.

🔄️ Additional Information

No response

👀 Have you spent some time to check if this feature request has been raised before?

  • I checked and didn't find similar issue

Are you willing to submit PR?

None

@nirga nirga added good first issue Good for newcomers help wanted Extra attention is needed labels Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant