Skip to content

Commit

Permalink
Create test to ensure duplicate redirects can’t be created.
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwilsoncc committed Jun 1, 2023
1 parent a255dc9 commit 1d26bc1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/cypress/integration/safe-redirect-manager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,21 @@ describe('Test redirect rules', () => {
cy.verifyEndpointDead('wildcard-403-test/1', 'Test message for a 403 wildcard');
});

it('Can not create a duplicate redirect rule', () => {
cy.createRedirectRule(
'/duplicate-rule-test/',
'/hello-world/',
'Rule for testing duplicate rule creation.'
);

cy.visit('/wp-admin/post-new.php?post_type=redirect_rule');

cy.get('#srm_redirect_rule_from').click().clear().type('/duplicate-rule-test/');
cy.get('#srm_redirect_rule_to').click();

cy.get('.notice-error').should('contain', 'There is an existing redirect with the same Redirect From URL.');
});

it('Can die with a 403 header', () => {
cy.createRedirectRule(
'/403-test',
Expand Down

0 comments on commit 1d26bc1

Please sign in to comment.