Skip to content

Commit

Permalink
fix canonical tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eonwarped committed Oct 2, 2019
1 parent cc2c868 commit a2621e0
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/app/utils/CanonicalLinker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ describe('makeCanonicalLink', () => {
[
'handles posts without app',
{ ...post_data, json_metadata: {} },
`${APP_URL}/testing/@test/test-post`,
`https://steemit.com/testing/@test/test-post`,
],
[
'handles empty strings as app',
{ ...post_data, json_metadata: { app: '' } },
`${APP_URL}/testing/@test/test-post`,
`https://steemit.com/testing/@test/test-post`,
],
[
"handles apps that don't exist",
{ ...post_data, json_metadata: { app: 'fakeapp/1.2.3' } },
`${APP_URL}/testing/@test/test-post`,
`https://steemit.com/testing/@test/test-post`,
],
[
"handles app that don't exist without version",
{ ...post_data, json_metadata: { app: 'fakeapp' } },
`${APP_URL}/testing/@test/test-post`,
`https://steemit.com/testing/@test/test-post`,
],
[
'handles apps that do exist',
Expand All @@ -39,23 +39,15 @@ describe('makeCanonicalLink', () => {
{ ...post_data, json_metadata: { app: 'steemit/0.1' } },
'https://steemit.com/testing/@test/test-post',
],
[
'handles posts from app',
{
...post_data,
json_metadata: { app: `${APP_NAME.toLowerCase()}/0.1` },
},
`${APP_URL}/testing/@test/test-post`,
],
[
'handles badly formatted app strings',
{ ...post_data, json_metadata: { app: 'fakeapp/0.0.1/a////' } },
`${APP_URL}/testing/@test/test-post`,
`https://steemit.com/testing/@test/test-post`,
],
[
'handles objects as apps',
{ ...post_data, json_metadata: { app: { this_is: 'an objct' } } },
`${APP_URL}/testing/@test/test-post`,
`https://steemit.com/testing/@test/test-post`,
],
];
test_cases.forEach(v => {
Expand Down

0 comments on commit a2621e0

Please sign in to comment.