|
@@ -90,6 +90,12 @@ describe('Custom fields', () => {
|
|
|
public: true,
|
|
public: true,
|
|
|
},
|
|
},
|
|
|
],
|
|
],
|
|
|
|
|
+ Facet: [
|
|
|
|
|
+ {
|
|
|
|
|
+ name: 'translated',
|
|
|
|
|
+ type: 'localeString',
|
|
|
|
|
+ },
|
|
|
|
|
+ ],
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
);
|
|
);
|
|
@@ -165,6 +171,28 @@ describe('Custom fields', () => {
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+ it('get entity with localeString only', async () => {
|
|
|
|
|
+ const { facet } = await adminClient.query(gql`
|
|
|
|
|
+ query {
|
|
|
|
|
+ facet(id: "T_1") {
|
|
|
|
|
+ id
|
|
|
|
|
+ name
|
|
|
|
|
+ customFields {
|
|
|
|
|
+ translated
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ `);
|
|
|
|
|
+
|
|
|
|
|
+ expect(facet).toEqual({
|
|
|
|
|
+ id: 'T_1',
|
|
|
|
|
+ name: 'category',
|
|
|
|
|
+ customFields: {
|
|
|
|
|
+ translated: null,
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
it('get fields with default values', async () => {
|
|
it('get fields with default values', async () => {
|
|
|
const { product } = await adminClient.query(gql`
|
|
const { product } = await adminClient.query(gql`
|
|
|
query {
|
|
query {
|
|
@@ -380,15 +408,10 @@ describe('Custom fields', () => {
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
describe('sort & filter', () => {
|
|
describe('sort & filter', () => {
|
|
|
-
|
|
|
|
|
it('can sort by custom fields', async () => {
|
|
it('can sort by custom fields', async () => {
|
|
|
const { products } = await adminClient.query(gql`
|
|
const { products } = await adminClient.query(gql`
|
|
|
query {
|
|
query {
|
|
|
- products(options: {
|
|
|
|
|
- sort: {
|
|
|
|
|
- nullable: ASC
|
|
|
|
|
- }
|
|
|
|
|
- }) {
|
|
|
|
|
|
|
+ products(options: { sort: { nullable: ASC } }) {
|
|
|
totalItems
|
|
totalItems
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -400,13 +423,7 @@ describe('Custom fields', () => {
|
|
|
it('can filter by custom fields', async () => {
|
|
it('can filter by custom fields', async () => {
|
|
|
const { products } = await adminClient.query(gql`
|
|
const { products } = await adminClient.query(gql`
|
|
|
query {
|
|
query {
|
|
|
- products(options: {
|
|
|
|
|
- filter: {
|
|
|
|
|
- stringWithDefault: {
|
|
|
|
|
- contains: "hello"
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }) {
|
|
|
|
|
|
|
+ products(options: { filter: { stringWithDefault: { contains: "hello" } } }) {
|
|
|
totalItems
|
|
totalItems
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|