Skip to content

Commit

Permalink
updating test to include redirect_from on different pages
Browse files Browse the repository at this point in the history
  • Loading branch information
gracepark committed Jun 17, 2021
1 parent 184543b commit 11d0a47
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/unit/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ describe('pages module', () => {
.filter(['languageCode', 'en'])
.filter('redirect_from')
.map('redirect_from')
.flatten()
.value()
const duplicates = sourceRedirectFrom.reduce((acc, el, i, arr) => {

const foundDuplicates = sourceRedirectFrom.filter(files => {
return files.filter((e, i, a) => a.indexOf(e) !== i).length > 0
}).flat()

const duplicates = foundDuplicates.reduce((acc, el, i, arr) => {
if (arr.indexOf(el) !== i && acc.indexOf(el) < 0) acc.push(el)
return acc
}, [])
Expand Down

0 comments on commit 11d0a47

Please sign in to comment.