-
-
Notifications
You must be signed in to change notification settings - Fork 45
Begin Philomena Search Syntax parser snapshot tests #571
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
base: master
Are you sure you want to change the base?
Begin Philomena Search Syntax parser snapshot tests #571
Conversation
eb11616 to
f14f637
Compare
test/support/phiql_case.ex
Outdated
| @@ -0,0 +1,138 @@ | |||
| defmodule Philomena.QueryCase do | |||
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.
Todo rename QueryCase to PhiqlCase
|
De-ponify the test queries (since I assume it doesn't really matter what they are), we're aiming for eventual debranding and more neutral texts in the software in the future. |
|
I also think calling it just "query" instead of "phiql" is less confusing. In my mind the language's name has always been just "search syntax" or "query syntax". |
|
Marking as draft until I fix the review comments |
|
This is now ready for review Fixed the review comments and improved the code a bit:
|
fc1f6c5 to
7a90475
Compare
| user_fixture(attrs) | ||
| |> Users.User.confirm_changeset() | ||
| |> Repo.update!() | ||
| user_fixture(Map.put(attrs, :confirmed, true)) |
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.
use |> syntax here (and the next occurence)
attrs
|> Map.put(...)
|> user_fixture()
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.
Fixed in 4f90db5. Had to rebase to fix merge conflicts
ae199f5 to
92c4328
Compare
92c4328 to
4f90db5
Compare
Added the initial plumbing for Philomena Search Syntax parser tests.
The bulk of this code implements the "testing engine" for the parser. The tests are defined declaratively like this:
This test can be invoked either via the regular
mix testto validate that the existing test snapshot is fresh. Or viaphilomena update-phiql-teststo update the test snapshot after a change was made to the source code. The test snapshot has this format in the simplest form:{ "wildcard": [ { "philomena": "*", "opensearch": { "match_all": {} } } ] }There can be an additional
contextskey in the test case in case if the parser output differs between contexts like anon user, regular user or admin/mod user.Todo
Fix this comment from @liamwhite in Discord:
Consider using toml instead of JSON and try define the test inputs directly in the snapshot?