Skip to content

Commit

Permalink
feat: remove some of the comments
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiAlexandruParaschiv committed Aug 12, 2024
1 parent bb67885 commit 6bfa5c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/canonical/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export const CANONICAL_CHECKS = Object.freeze({
check: 'canonical-url-status-ok',
explanation: 'The canonical URL should return a 200 status code to ensure it is accessible and indexable by search engines.',
},
CANONICAL_URL_NO_REDIRECT: {
check: 'canonical-url-no-redirect',
explanation: 'The canonical URL should be a direct link without redirects to ensure search engines recognize the intended page.',
},
CANONICAL_URL_4XX: {
check: 'canonical-url-4xx',
explanation: 'The canonical URL returns a 4xx error, indicating it is inaccessible, which can harm SEO visibility.',
Expand All @@ -44,10 +48,6 @@ export const CANONICAL_CHECKS = Object.freeze({
check: 'canonical-url-5xx',
explanation: 'The canonical URL returns a 5xx server error, indicating it is temporarily or permanently unavailable, affecting SEO performance.',
},
CANONICAL_URL_NO_REDIRECT: {
check: 'canonical-url-no-redirect',
explanation: 'The canonical URL should be a direct link without redirects to ensure search engines recognize the intended page.',
},
CANONICAL_SELF_REFERENCED: {
check: 'canonical-self-referenced',
explanation: 'The canonical URL should point to itself to indicate that it is the preferred version of the content.',
Expand Down
8 changes: 3 additions & 5 deletions test/audits/canonical.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ describe('Canonical URL Tests', () => {

it('should handle 4xx error response correctly', async () => {
const canonicalUrl = 'http://example.com/404';
nock('http://example.com').get('/404').reply(404); // Simulate a 404 response
nock('http://example.com').get('/404').reply(404);

const result = await validateCanonicalRecursively(canonicalUrl, log);

Expand All @@ -457,7 +457,7 @@ describe('Canonical URL Tests', () => {

it('should handle 5xx error response correctly', async () => {
const canonicalUrl = 'http://example.com/500';
nock('http://example.com').get('/500').reply(500); // Simulate a 500 response
nock('http://example.com').get('/500').reply(500);

const result = await validateCanonicalRecursively(canonicalUrl, log);

Expand All @@ -473,7 +473,6 @@ describe('Canonical URL Tests', () => {
const href = '/canonical-page';
const expectedCanonicalUrl = 'https://example.com/canonical-page';

// Mock the HTML content with a canonical link
const html = `
<html>
<head>
Expand All @@ -485,7 +484,6 @@ describe('Canonical URL Tests', () => {
</html>
`;

// Mock the fetch response to return the above HTML
nock('https://example.com')
.get('/some-page')
.reply(200, html);
Expand All @@ -508,7 +506,7 @@ describe('Canonical URL Tests', () => {

it('should handle unexpected status code response correctly', async () => {
const canonicalUrl = 'http://example.com/300';
nock('http://example.com').get('/300').reply(300); // Simulate a 300 response
nock('http://example.com').get('/300').reply(300);

const result = await validateCanonicalRecursively(canonicalUrl, log);

Expand Down

0 comments on commit 6bfa5c4

Please sign in to comment.