Skip to content

Commit

Permalink
FIX: Broken Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dwhieb committed Jul 19, 2024
1 parent 39695b7 commit fd732d6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions pages/Search/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,20 @@ export function Search(req, res) {
let {
limit = 100,
offset = 0,
q,
sort = ``,
} = req.query

const {
diacritics,
language,
q,
} = req.query

// Search

let results = req.app.db.search(q.trim(), { diacritics, language })
q = q.trim().normalize() // Normalize search text since data in database is also normalized.

let results = req.app.db.search(q, { diacritics, language })
const numTotalResults = results.length

// Sort
Expand Down
4 changes: 2 additions & 2 deletions pages/Search/Search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe(`Search`, function() {
cy.get(`#diacritics-box`).check()
cy.get(`#search-box`).type(`aštimw`)
cy.get(`form`).submit()
cy.get(`.num-results`).should(`include.text`, `of 1`)
cy.get(`.num-results`).should(`include.text`, `of 2`)
})

it(`Form (Project)`, function() {
Expand Down Expand Up @@ -158,7 +158,7 @@ describe(`Search`, function() {
// Return first page of results by default
cy.get(`#results td`).first().should(`have.text`, `Abenaki`)
.next()
.should(`have.text`, `ôben-`)
.should(`have.text`, `ɔ̃ben-`)

// Showing X of Y results.
cy.get(`.num-results`).invoke(`text`).should(`match`, /^Showing results 1–100 of .+?\.$/v)
Expand Down

0 comments on commit fd732d6

Please sign in to comment.