Only use fetch for search when running in cypress
This commit is contained in:
parent
a50d46ba32
commit
1b60fb5988
|
@ -351,8 +351,8 @@ exports.bulkDestroy = async ctx => {
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.search = async ctx => {
|
exports.search = async ctx => {
|
||||||
// Fetch the whole table when running tests, as search doesn't work
|
// Fetch the whole table when running in cypress, as search doesn't work
|
||||||
if (env.isTest()) {
|
if (env.isCypress()) {
|
||||||
return { rows: await exports.fetch(ctx) }
|
return { rows: await exports.fetch(ctx) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,10 @@ function isDev() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isCypress() {
|
||||||
|
return process.env.NODE_ENV === "cypress"
|
||||||
|
}
|
||||||
|
|
||||||
let LOADED = false
|
let LOADED = false
|
||||||
if (!LOADED && isDev() && !isTest()) {
|
if (!LOADED && isDev() && !isTest()) {
|
||||||
require("dotenv").config()
|
require("dotenv").config()
|
||||||
|
@ -61,6 +65,7 @@ module.exports = {
|
||||||
module.exports[key] = value
|
module.exports[key] = value
|
||||||
},
|
},
|
||||||
isTest,
|
isTest,
|
||||||
|
isCypress,
|
||||||
isDev,
|
isDev,
|
||||||
isProd: () => {
|
isProd: () => {
|
||||||
return !isDev()
|
return !isDev()
|
||||||
|
|
Loading…
Reference in New Issue