mirror of
https://github.com/strapi/strapi.git
synced 2025-07-25 18:05:07 +00:00
fix: strapi search api tests
This commit is contained in:
parent
54bac609ca
commit
e204f16a71
@ -743,6 +743,8 @@ describe('Core API - Validate', () => {
|
|||||||
|
|
||||||
describe('Fields', () => {
|
describe('Fields', () => {
|
||||||
const allDocumentFields = [
|
const allDocumentFields = [
|
||||||
|
// TODO: Document id should not be in attributes
|
||||||
|
'documentId',
|
||||||
'name',
|
'name',
|
||||||
'name_non_searchable',
|
'name_non_searchable',
|
||||||
'misc',
|
'misc',
|
||||||
|
@ -54,7 +54,7 @@ const bedModel = {
|
|||||||
|
|
||||||
const bedFixtures = [
|
const bedFixtures = [
|
||||||
{
|
{
|
||||||
// will have id=1
|
documentId: 'fixture-a',
|
||||||
name: 'Sleepy Bed',
|
name: 'Sleepy Bed',
|
||||||
weight: 12.4,
|
weight: 12.4,
|
||||||
shortDescription: 'Is a good bed to sleep in.',
|
shortDescription: 'Is a good bed to sleep in.',
|
||||||
@ -67,7 +67,7 @@ const bedFixtures = [
|
|||||||
fabricThickness: 1.14157,
|
fabricThickness: 1.14157,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// will have id=2
|
documentId: 'fixture-b',
|
||||||
name: 'Tired Bed',
|
name: 'Tired Bed',
|
||||||
weight: 11.1,
|
weight: 11.1,
|
||||||
shortDescription: 'You will never wake up again.',
|
shortDescription: 'You will never wake up again.',
|
||||||
@ -80,7 +80,7 @@ const bedFixtures = [
|
|||||||
fabricThickness: 1.0001,
|
fabricThickness: 1.0001,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// will have id=3
|
documentId: 'fixture-3',
|
||||||
// other beds don't contain any 3 in order to find only Zombie Bed when searching 3
|
// other beds don't contain any 3 in order to find only Zombie Bed when searching 3
|
||||||
name: 'Zombie Bed',
|
name: 'Zombie Bed',
|
||||||
weight: null,
|
weight: null,
|
||||||
@ -94,7 +94,7 @@ const bedFixtures = [
|
|||||||
fabricThickness: null,
|
fabricThickness: null,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// will have id=4
|
documentId: 'fixture-d',
|
||||||
name: 'a*b_c%d\\e+f',
|
name: 'a*b_c%d\\e+f',
|
||||||
weight: null,
|
weight: null,
|
||||||
shortDescription: null,
|
shortDescription: null,
|
||||||
@ -107,7 +107,7 @@ const bedFixtures = [
|
|||||||
fabricThickness: null,
|
fabricThickness: null,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// will have id=5
|
documentId: 'fixture-e',
|
||||||
name: 'Tired Bed',
|
name: 'Tired Bed',
|
||||||
weight: null,
|
weight: null,
|
||||||
shortDescription: null,
|
shortDescription: null,
|
||||||
@ -137,12 +137,12 @@ describe('Search query', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Without filters', () => {
|
describe('Without filters', () => {
|
||||||
test('search for "id"', async () => {
|
test('search for "documentId"', async () => {
|
||||||
const res = await rq({
|
const res = await rq({
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
url: '/beds',
|
url: '/beds',
|
||||||
qs: {
|
qs: {
|
||||||
_q: data.bed[2].id,
|
_q: data.bed[2].documentId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user