Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('updates index when a Collection created', async () => {
const { createCollection } = await adminClient.query<
CreateCollection.Mutation,
CreateCollection.Variables
>(CREATE_COLLECTION, {
input: {
translations: [
{
languageCode: LanguageCode.en,
name: 'Photo',
description: '',
},
],
filters: [
{
code: facetValueCollectionFilter.code,
arguments: [
{
name: 'facetValueIds',
value: `["T_3"]`,
type: 'facetValueIds',
},
{
name: 'containsAny',
value: `false`,
type: 'boolean',
},
],
},
],
},
});
it('creates a 2nd level nested collection', async () => {
const result = await adminClient.query(
CREATE_COLLECTION,
{
input: {
parentId: computersCollection.id,
translations: [{ languageCode: LanguageCode.en, name: 'Pear', description: '' }],
filters: [
{
code: facetValueCollectionFilter.code,
arguments: [
{
name: 'facetValueIds',
value: `["${getFacetValueId('pear')}"]`,
type: 'facetValueIds',
},
{
name: 'containsAny',
value: `false`,
type: 'boolean',
},
],
},
],
},
},
it('updates index when a Collection is changed', async () => {
await adminClient.query(
UPDATE_COLLECTION,
{
input: {
id: 'T_2',
filters: [
{
code: facetValueCollectionFilter.code,
arguments: [
{
name: 'facetValueIds',
value: `["T_4"]`,
type: 'facetValueIds',
},
{
name: 'containsAny',
value: `false`,
type: 'boolean',
},
],
},
],
},
},
it('updates index when a Collection created', async () => {
const { createCollection } = await adminClient.query<
CreateCollection.Mutation,
CreateCollection.Variables
>(CREATE_COLLECTION, {
input: {
translations: [
{
languageCode: LanguageCode.en,
name: 'Photo',
description: '',
},
],
filters: [
{
code: facetValueCollectionFilter.code,
arguments: [
{
name: 'facetValueIds',
value: `["T_3"]`,
type: 'facetValueIds',
},
{
name: 'containsAny',
value: `false`,
type: 'boolean',
},
],
},
],
},
});
it('updates index when a Collection is changed', async () => {
await adminClient.query(
UPDATE_COLLECTION,
{
input: {
id: 'T_2',
filters: [
{
code: facetValueCollectionFilter.code,
arguments: [
{
name: 'facetValueIds',
value: `["T_4"]`,
type: 'facetValueIds',
},
{
name: 'containsAny',
value: `false`,
type: 'boolean',
},
],
},
],
},
},
it('creates a root collection', async () => {
const result = await adminClient.query(
CREATE_COLLECTION,
{
input: {
assetIds: [assets[0].id, assets[1].id],
featuredAssetId: assets[1].id,
filters: [
{
code: facetValueCollectionFilter.code,
arguments: [
{
name: 'facetValueIds',
value: `["${getFacetValueId('electronics')}"]`,
type: 'facetValueIds',
},
{
name: 'containsAny',
value: `false`,
type: 'boolean',
},
],
},
],
translations: [
{ languageCode: LanguageCode.en, name: 'Electronics', description: '' },
beforeAll(async () => {
const result = await adminClient.query(GET_FACET_LIST);
const category = result.facets.items[0];
const sportsEquipment = category.values.find(v => v.code === 'sports-equipment')!;
const { createCollection } = await adminClient.query<
CreateCollection.Mutation,
CreateCollection.Variables
>(CREATE_COLLECTION, {
input: {
filters: [
{
code: facetValueCollectionFilter.code,
arguments: [
{
name: 'facetValueIds',
value: `["${sportsEquipment.id}"]`,
type: 'facetValueIds',
},
{
name: 'containsAny',
value: `false`,
type: 'boolean',
},
],
},
],
translations: [{ languageCode: LanguageCode.en, name: 'My Collection', description: '' }],
},