Skip to content

Commit

Permalink
refactor: clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
axe312ger committed Apr 13, 2021
1 parent 0992ebd commit 67f316c
Show file tree
Hide file tree
Showing 6 changed files with 147 additions and 129 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import React from "react"

export const ContentfulContentReference = ({
one,
many,
content_reference,
title,
}) => {
const references = [
one,
...(many || []),
...(content_reference || []),
].filter(Boolean)
export const ContentfulContentReference = ({ one, many, title }) => {
const references = [one, ...(many || [])].filter(Boolean)
return (
<p data-cy-id="reference">
[ContentfulReference] {title}: [
Expand Down
23 changes: 14 additions & 9 deletions e2e-tests/contentful/src/pages/content-reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,40 +53,45 @@ export const pageQuery = graphql`
contentful_id
one {
__typename
contentful_id
... on ContentfulText {
contentful_id
title
short
}
... on ContentfulContentReference {
contentful_id
title
content_reference {
one {
... on ContentfulContentReference {
title
}
}
many {
... on ContentfulContentReference {
contentful_id
title
}
}
}
}
many {
__typename
contentful_id
... on ContentfulText {
contentful_id
title
short
}
... on ContentfulNumber {
contentful_id
title
integer
}
... on ContentfulContentReference {
contentful_id
title
content_reference {
one {
... on ContentfulContentReference {
title
}
}
many {
... on ContentfulContentReference {
id
title
}
}
Expand Down
28 changes: 20 additions & 8 deletions e2e-tests/contentful/src/pages/rich-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,34 +118,46 @@ export const pageQuery = graphql`
contentful_id
title
one {
__typename
contentful_id
... on ContentfulText {
title
short
}
... on ContentfulContentReference {
contentful_id
title
content_reference {
one {
... on ContentfulContentReference {
title
}
}
many {
... on ContentfulContentReference {
contentful_id
title
}
}
}
}
many {
__typename
contentful_id
... on ContentfulText {
contentful_id
title
short
}
... on ContentfulNumber {
contentful_id
title
integer
}
... on ContentfulContentReference {
contentful_id
title
content_reference {
one {
... on ContentfulContentReference {
title
}
}
many {
... on ContentfulContentReference {
id
title
}
}
Expand Down
Loading

0 comments on commit 67f316c

Please sign in to comment.