-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
fix: operator 'or' and escape character not working (#6705) #6708
Conversation
|
✅ Deploy Preview for refine-doc-live-previews ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -2008,7 +2008,7 @@ nock("https://iwdfzvfqbtokqetmbmbp.supabase.co:443", { | |||
select: "%2A", | |||
offset: "0", | |||
limit: "10", | |||
or: "%28title.ilike.%25Black+Psorotichia%25%2Ccontent.ilike.%25Sed+sagittis%25%29", | |||
or: "%28title.ilike.%22%25Black+Psorotichia%25%22%2Ccontent.ilike.%22%25Sed+sagittis%25%22%29", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you are changing the mock manually.
To make tests truly meaningful, we should record them using mock. You can uncomment here to record responses. After that, nock will print the responses in the console so we can copy and use them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for my ignorance this is my first time, so what I should do is uncomment that part of the code and then run:
pnpm test -- --scope @refinedev/supabase --verbose
which will generate something in console to then replace that in the mock file or just uncomment and push the code?
Because I did try to uncomment and run the test locally but many tests failed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because when we enable nock.recorder.rec();
, requests go to the database. Unfortunately, our Supabase database has changed a lot since this test was written (mutation test failures are due to auth policies), and updating all nocks would take too much time.
I ran only the getList
tests using this command:
pnpm test -- --scope @refinedev/supabase -- --testPathPattern=packages/supabase/test/getList/index.spec.ts
I ignored all tests except "contains operator should work correctly with or"
because only its logic has changed. The nock response I got is:
nock("https://iwdfzvfqbtokqetmbmbp.supabase.co:443", {
encodedQueryParams: true,
})
.get("/rest/v1/posts")
.query({
select: "%2A",
offset: "0",
limit: "10",
or: "%28title.ilike.%22%25Black%20Psorotichia%25%22%2Ccontent.ilike.%22%25Sed%20sagittis%25%22%29",
})
.reply(
200,
[
{
id: 1,
title: "Black Psorotichia Lichen",
slug: "61a31089-c85d-48a0-a4be-d5dce5c96b6a",
createdAt: "2024-04-24T13:20:10.200327+00:00",
content:
"Integer tincidunt ante vel ipsum. Praesent blandit lacinia erat. Vestibulum sed magna at nunc commodo placerat.\n\nPraesent blandit. Nam nulla. Integer pede justo, lacinia eget, tincidunt eget, tempus vel, pede.\n\nMorbi porttitor lorem id ligula. Suspendisse ornare consequat lectus. In est risus, auctor sed, tristique in, tempus sit amet, sem.",
categoryId: 7,
images: null,
},
{
id: 13,
title: "Dust Lichen",
slug: "ca038c02-0c6f-417b-aaf8-6f51b777d1f5",
createdAt: "2024-04-24T13:20:10.200327+00:00",
content:
"Fusce posuere felis sed lacus. Morbi sem mauris, laoreet ut, rhoncus aliquet, pulvinar sed, nisl. Nunc rhoncus dui vel sem.\n\nSed sagittis. Nam congue, risus semper porta volutpat, quam pede lobortis ligula, sit amet eleifend pede libero quis orci. Nullam molestie nibh in lectus.",
categoryId: 7,
images: null,
},
],
[
"Date",
"Mon, 17 Mar 2025 10:29:52 GMT",
"Content-Type",
"application/json; charset=utf-8",
"Transfer-Encoding",
"chunked",
"Connection",
"close",
"Content-Range",
"0-1/2",
"CF-Ray",
"921bcfca7bad925f-FRA",
"CF-Cache-Status",
"DYNAMIC",
"Content-Location",
"/posts?limit=10&offset=0&or=%28title.ilike.%22%25Black%20Psorotichia%25%22%2Ccontent.ilike.%22%25Sed%20sagittis%25%22%29&select=%2A",
"Strict-Transport-Security",
"max-age=31536000; includeSubDomains; preload",
"Vary",
"Accept-Encoding",
"content-profile",
"public",
"preference-applied",
"count=exact",
"sb-gateway-version",
"1",
"sb-project-ref",
"iwdfzvfqbtokqetmbmbp",
"X-Content-Type-Options",
"nosniff",
"x-envoy-attempt-count",
"1",
"x-envoy-upstream-service-time",
"18",
"Server",
"cloudflare",
"alt-svc",
'h3=":443"; ma=86400',
],
);
I was going to push this to the PR, but I got a permission denied error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay thanks for your help I will keep this in mind for feature requests. I used the response that you got and pushed the commit.
For more details this is the issue:
#6705
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
What is the new behavior?
fixes (issue)
Notes for reviewers