Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
duogenesis committed Jan 5, 2025
1 parent b2451cd commit 0ecae9a
Showing 1 changed file with 81 additions and 3 deletions.
84 changes: 81 additions & 3 deletions test/functionality1/search.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,87 @@ test_photos_promoted () {
}

test_verified_promoted () {
setup
seq 250 | xargs -I'{}' ../util/create-user.sh "extrauser{}" 0 0

q "delete from photo"
q "update person set has_profile_picture_id = 1"
q "update person set verification_level_id = 1"

q "
update person
set personality = array_full(47, 0)"
q "
update person
set personality = array_full(47, 9e-2)
where email IN ('[email protected]', '[email protected]')"
q "
update person
set personality = array_full(47, 8e-2)
where email IN ('[email protected]')"
q "
update person
set personality = array_full(47, 7e-2)
where email IN ('[email protected]')"
q "
update person
set personality = array_full(47, 6e-2)
where email IN ('[email protected]')"
q "
update person
set personality = array_full(47, 5e-2)
where email IN ('[email protected]')"
q "
update person
set personality = array_full(47, 4e-2)
where email IN ('[email protected]')"
q "
update person
set personality = array_full(47, 3e-2)
where email IN ('[email protected]')"

local response=$(c GET '/search?n=5&o=0' | jq -r '[.[].name] | join(" ")')
[[ "$response" = 'user1 user2 extrauser1 extrauser2 extrauser3' ]]

q "
update
person
set
verification_level_id = 2
where
name = 'extrauser1'
"

local response=$(c GET '/search?n=5&o=0' | jq -r '[.[].name] | join(" ")')
[[ "$response" = 'user1 user2 extrauser1 extrauser2 extrauser3' ]]

q "
update
person
set
verification_level_id = 2
where
name <> 'user1'
and
name <> 'extrauser3'
"

local response=$(c GET '/search?n=5&o=0' | jq -r '[.[].name] | join(" ")')
[[ "$response" = 'user2 extrauser1 extrauser2 extrauser4 extrauser5' ]]

# If the searcher isn't verified, they don't necessarily see verified members
# first
q "
update
person
set
verification_level_id = 1
where
name = 'searcher'
"

local response=$(c GET '/search?n=5&o=0' | jq -r '[.[].name] | join(" ")')
[[ "$response" = 'user1 user2 extrauser1 extrauser2 extrauser3' ]]
}

test_quiz_filters () {
Expand Down Expand Up @@ -801,9 +882,6 @@ test_pending_club_cleared () {
}


test_verified_promoted
exit 42

test_pending_club_cleared

test_clubs
Expand Down

0 comments on commit 0ecae9a

Please sign in to comment.