fix: admin collections default relations (#1023)

* added default relations to retrieve collection endpoint

* push snapshot

* added created at and updated at to collection list endpoint

* updated integration tests

* added q param to list collections

* updated snapshots
This commit is contained in:
Kasper Fabricius Kristensen
2022-02-04 16:24:42 +01:00
committed by GitHub
parent 59bb413245
commit d2a7534615
9 changed files with 171 additions and 44 deletions

View File

@@ -18,6 +18,7 @@ exports[`/admin/collections /admin/collections filters collections by title 1`]
Object {
"collections": Array [
Object {
"created_at": Any<String>,
"handle": "test-collection",
"id": "test-collection",
"products": Array [
@@ -77,6 +78,7 @@ Object {
},
],
"title": "Test collection",
"updated_at": Any<String>,
},
],
"count": 1,
@@ -89,6 +91,7 @@ exports[`/admin/collections /admin/collections lists collections 1`] = `
Object {
"collections": Array [
Object {
"created_at": Any<String>,
"handle": "test-collection",
"id": "test-collection",
"products": Array [
@@ -148,8 +151,10 @@ Object {
},
],
"title": "Test collection",
"updated_at": Any<String>,
},
Object {
"created_at": Any<String>,
"handle": "test-collection1",
"id": "test-collection1",
"products": Array [
@@ -209,8 +214,10 @@ Object {
},
],
"title": "Test collection 1",
"updated_at": Any<String>,
},
Object {
"created_at": Any<String>,
"handle": "test-collection2",
"id": "test-collection2",
"products": Array [
@@ -243,6 +250,7 @@ Object {
},
],
"title": "Test collection 2",
"updated_at": Any<String>,
},
],
"count": 3,
@@ -259,6 +267,62 @@ Object {
"handle": "test-collection",
"id": "test-collection",
"metadata": null,
"products": Array [
Object {
"collection_id": "test-collection",
"created_at": Any<String>,
"deleted_at": null,
"description": "test-product-description",
"discountable": true,
"external_id": null,
"handle": "test-product",
"height": null,
"hs_code": null,
"id": "test-product",
"is_giftcard": false,
"length": null,
"material": null,
"metadata": null,
"mid_code": null,
"origin_country": null,
"profile_id": StringMatching /\\^sp_\\*/,
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Test product",
"type_id": "test-type",
"updated_at": Any<String>,
"weight": null,
"width": null,
},
Object {
"collection_id": "test-collection",
"created_at": Any<String>,
"deleted_at": null,
"description": "test-product-description1",
"discountable": true,
"external_id": null,
"handle": "test-product1",
"height": null,
"hs_code": null,
"id": "test-product1",
"is_giftcard": false,
"length": null,
"material": null,
"metadata": null,
"mid_code": null,
"origin_country": null,
"profile_id": StringMatching /\\^sp_\\*/,
"status": "draft",
"subtitle": null,
"thumbnail": null,
"title": "Test product1",
"type_id": "test-type",
"updated_at": Any<String>,
"weight": null,
"width": null,
},
],
"title": "Test collection",
"updated_at": Any<String>,
},

View File

@@ -107,6 +107,20 @@ describe("/admin/collections", () => {
id: "test-collection",
created_at: expect.any(String),
updated_at: expect.any(String),
products: [
{
collection_id: "test-collection",
created_at: expect.any(String),
updated_at: expect.any(String),
profile_id: expect.stringMatching(/^sp_*/),
},
{
collection_id: "test-collection",
created_at: expect.any(String),
updated_at: expect.any(String),
profile_id: expect.stringMatching(/^sp_*/),
},
],
},
})
})
@@ -165,6 +179,8 @@ describe("/admin/collections", () => {
id: "test-collection",
handle: "test-collection",
title: "Test collection",
created_at: expect.any(String),
updated_at: expect.any(String),
products: [
{
collection_id: "test-collection",
@@ -184,6 +200,8 @@ describe("/admin/collections", () => {
id: "test-collection1",
handle: "test-collection1",
title: "Test collection 1",
created_at: expect.any(String),
updated_at: expect.any(String),
products: [
{
collection_id: "test-collection1",
@@ -203,6 +221,8 @@ describe("/admin/collections", () => {
id: "test-collection2",
handle: "test-collection2",
title: "Test collection 2",
created_at: expect.any(String),
updated_at: expect.any(String),
products: [
{
collection_id: "test-collection2",
@@ -232,6 +252,8 @@ describe("/admin/collections", () => {
id: "test-collection",
handle: "test-collection",
title: "Test collection",
created_at: expect.any(String),
updated_at: expect.any(String),
products: [
{
collection_id: "test-collection",