Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinhenderson committed Nov 14, 2023
1 parent 5ed974b commit b14e4a2
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions lib/products/get-all-products.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ it("throws an error if there are more products than we query for", async () => {
databaseId: i,
date: "date",
modified: "date",
menuOrderRaw: 1,
});
}
const mockResponse = {
Expand Down Expand Up @@ -76,6 +77,7 @@ it("gets all the slugs and names for each product", async () => {
databaseId: 1,
date: "date",
modified: "date",
menuOrderRaw: 1,
},
],
},
Expand All @@ -98,6 +100,7 @@ it("gets all the slugs and names for each product", async () => {
description: null,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,
date: "date",
projects: [],
inStock: true,
Expand Down Expand Up @@ -135,6 +138,7 @@ it("returns a list of variations", async () => {
name: "ABC with core words",
date: "date",
modified: "date",
menuOrderRaw: 1,

variations: {
nodes: [
Expand Down Expand Up @@ -170,6 +174,7 @@ it("returns a list of variations", async () => {
ebook: null,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

variations: [
{
Expand Down Expand Up @@ -231,6 +236,7 @@ it("returns price as an int when returned null", async () => {
{
date: "date",
modified: "date",
menuOrderRaw: 1,

databaseId: 1,
slug: "my-product",
Expand Down Expand Up @@ -263,6 +269,7 @@ it("returns price as an int when returned null", async () => {
ebook: null,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

category: {
name: "Product",
Expand Down Expand Up @@ -293,6 +300,7 @@ it("returns null when its not a valid price", async () => {
{
date: "date",
modified: "date",
menuOrderRaw: 1,

databaseId: 1,
slug: "my-product",
Expand Down Expand Up @@ -325,6 +333,7 @@ it("returns null when its not a valid price", async () => {
ebook: null,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

category: {
name: "Product",
Expand Down Expand Up @@ -361,6 +370,7 @@ it("parses a root price to a number", async () => {
image: null,
date: "date",
modified: "date",
menuOrderRaw: 1,
},
],
},
Expand All @@ -385,6 +395,7 @@ it("parses a root price to a number", async () => {
date: "date",
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

projects: [],
inStock: true,
Expand Down Expand Up @@ -423,6 +434,7 @@ it("parses a variation price to a number", async () => {
name: "My super awesome product",
date: "date",
modified: "date",
menuOrderRaw: 1,

variations: {
nodes: [
Expand Down Expand Up @@ -462,6 +474,7 @@ it("parses a variation price to a number", async () => {
totalSales: 0,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

featured: false,
description: null,
Expand Down Expand Up @@ -501,6 +514,7 @@ it("also returns a root price when all the variations are the same", async () =>
name: "My super awesome product",
date: "date",
modified: "date",
menuOrderRaw: 1,

variations: {
nodes: [
Expand All @@ -520,6 +534,7 @@ it("also returns a root price when all the variations are the same", async () =>
id: 1,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

variations: [
{
Expand Down Expand Up @@ -590,6 +605,7 @@ it("returns a min and max price when the variations are different", async () =>
name: "My super awesome product",
date: "date",
modified: "date",
menuOrderRaw: 1,

variations: {
nodes: [
Expand All @@ -609,6 +625,7 @@ it("returns a min and max price when the variations are different", async () =>
name: "My super awesome product",
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

variations: [
{
Expand Down Expand Up @@ -681,6 +698,7 @@ it("returns a min and max price when the variations are different and one is nul
name: "My super awesome product",
date: "date",
modified: "date",
menuOrderRaw: 1,

variations: {
nodes: [
Expand All @@ -700,6 +718,7 @@ it("returns a min and max price when the variations are different and one is nul
id: 1,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

variations: [
{
Expand Down Expand Up @@ -774,6 +793,7 @@ it("returns the featured image if it exists", async () => {
variations: null,
date: "date",
modified: "date",
menuOrderRaw: 1,

image: {
altText: "my image alt",
Expand All @@ -792,6 +812,7 @@ it("returns the featured image if it exists", async () => {
{
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

id: 1,
slug: "my-product",
Expand Down Expand Up @@ -851,6 +872,7 @@ it("returns the an image gallery if it exists", async () => {
variations: null,
date: "date",
modified: "date",
menuOrderRaw: 1,

galleryImages: {
nodes: [
Expand Down Expand Up @@ -882,6 +904,7 @@ it("returns the an image gallery if it exists", async () => {
id: 1,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

slug: "my-product",
name: "My super awesome product",
Expand Down Expand Up @@ -949,6 +972,7 @@ it("removes incomplete images from the gallery", async () => {
variations: null,
date: "date",
modified: "date",
menuOrderRaw: 1,

galleryImages: {
nodes: [
Expand Down Expand Up @@ -986,6 +1010,7 @@ it("removes incomplete images from the gallery", async () => {
date: "date",
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

gallery: [
{
Expand Down Expand Up @@ -1041,6 +1066,7 @@ it("if the root product is free and its downloadable offer a download url", asyn
variations: null,
date: "date",
modified: "date",
menuOrderRaw: 1,

price: null,
downloadable: true,
Expand All @@ -1060,6 +1086,7 @@ it("if the root product is free and its downloadable offer a download url", asyn
variations: null,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

price: 0,
gallery: [],
Expand Down Expand Up @@ -1113,6 +1140,7 @@ it("Uses the root category", async () => {
variations: null,
date: "date",
modified: "date",
menuOrderRaw: 1,
price: null,
downloadable: true,
stockStatus: "IN_STOCK",
Expand Down Expand Up @@ -1143,6 +1171,7 @@ it("Uses the root category", async () => {
projects: [],
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

inStock: true,
shortDescription: null,
Expand Down Expand Up @@ -1184,6 +1213,7 @@ it("Uses the parent category", async () => {
variations: null,
date: "date",
modified: "date",
menuOrderRaw: 1,
price: null,
downloadable: true,
stockStatus: "IN_STOCK",
Expand Down Expand Up @@ -1216,6 +1246,7 @@ it("Uses the parent category", async () => {
shortDescription: null,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

ebook: null,
attachedResources: [],
Expand Down Expand Up @@ -1265,6 +1296,7 @@ it("Uses the parent parent category", async () => {
variations: null,
date: "date",
modified: "date",
menuOrderRaw: 1,
price: null,
downloadable: true,
stockStatus: "IN_STOCK",
Expand Down Expand Up @@ -1295,6 +1327,7 @@ it("Uses the parent parent category", async () => {
projects: [],
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

inStock: true,
shortDescription: null,
Expand Down Expand Up @@ -1333,6 +1366,7 @@ it("if the root product costs and its downloadable its not instantly downloadabl
variations: null,
date: "date",
modified: "date",
menuOrderRaw: 1,

price: "80.00",
downloadable: true,
Expand Down Expand Up @@ -1360,6 +1394,7 @@ it("if the root product costs and its downloadable its not instantly downloadabl
featured: false,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

description: null,
date: "date",
Expand Down Expand Up @@ -1401,6 +1436,7 @@ it("a variation can be instalantly downloadable", async () => {
name: "My super awesome product",
date: "date",
modified: "date",
menuOrderRaw: 1,

variations: {
nodes: [
Expand Down Expand Up @@ -1448,6 +1484,7 @@ it("a variation can be instalantly downloadable", async () => {
popupFormBehaviour: null,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

totalSales: 0,
featured: false,
Expand Down Expand Up @@ -1490,6 +1527,7 @@ it("passes the total sales of a single product", async () => {
price: null,
date: "date",
modified: "date",
menuOrderRaw: 1,

totalSales: 100,
},
Expand Down Expand Up @@ -1519,6 +1557,7 @@ it("passes the total sales of a single product", async () => {
ebook: null,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

attachedResources: [],
catalogVisibility: null,
Expand Down Expand Up @@ -1555,6 +1594,7 @@ it("adds up the total sales of the variants and uses that if its more", async ()
totalSales: 0,
date: "date",
modified: "date",
menuOrderRaw: 1,

variations: {
nodes: [
Expand Down Expand Up @@ -1627,6 +1667,7 @@ it("adds up the total sales of the variants and uses that if its more", async ()
description: null,
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

projects: [],
inStock: true,
Expand Down Expand Up @@ -1667,6 +1708,7 @@ it("uses the total sales of the root product if its more", async () => {
totalSales: 3,
date: "date",
modified: "date",
menuOrderRaw: 1,

variations: {
nodes: [
Expand Down Expand Up @@ -1706,6 +1748,7 @@ it("uses the total sales of the root product if its more", async () => {
gallery: [],
isLaunchpadTemplate: false,
faqs: [],
menuOrder: 1,

image: null,
instantDownloadAvailable: false,
Expand Down

0 comments on commit b14e4a2

Please sign in to comment.