-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added cypress + pages/new.js redirect
- Loading branch information
Showing
4 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"baseUrl": "http://localhost:3000" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
describe('pages/', () => { | ||
context('[username].js', () => { | ||
it('works', () => cy.visit("/random")) | ||
context('if user does not exist', () => { | ||
it('redirects to /index.js', () => { | ||
cy.visit('/random'); | ||
cy.location().should(loc => { | ||
expect(loc.pathname).to.eq('/'); | ||
}) | ||
}) | ||
}) | ||
|
||
context('user with username "optimistavf" does exist', () => { | ||
it('contains @optimistavf', () => { | ||
cy.visit('/optimistavf'); | ||
cy.contains("@optimistavf"); | ||
}) | ||
}) | ||
}); | ||
|
||
context('account/reset.js', () => { | ||
it('works', () => cy.visit("/account/reset")) | ||
}); | ||
|
||
context('account/confirm.js', () => { | ||
it('works', () => cy.visit("/account/confirm")) | ||
context('if not provided oobCode', () => { | ||
it('redirects to /account/reset.js', () => { | ||
cy.visit('/account/confirm'); | ||
cy.location().should(loc => { | ||
expect(loc.pathname).to.eq('/account/reset'); | ||
}) | ||
}) | ||
}) | ||
}); | ||
|
||
context('index.js', () => { | ||
it('works', () => cy.visit("/")) | ||
}); | ||
|
||
context('join.js', () => { | ||
it('works', () => cy.visit("/join")) | ||
}); | ||
|
||
context('login.js', () => { | ||
it('works', () => cy.visit("/login")) | ||
}); | ||
|
||
context('new.js', () => { | ||
it('works', () => cy.visit("/new")) | ||
context('if user is not logged in', () => { | ||
it('redirects to /index.js', () => { | ||
cy.visit('/new'); | ||
cy.location().should(loc => { | ||
expect(loc.pathname).to.eq('/'); | ||
}) | ||
}) | ||
}) | ||
}); | ||
|
||
context('s/[id].js', () => { | ||
it('works', () => cy.visit("/s/random")); | ||
context('if story does not exist', () => { | ||
it('redirects to /index.js', () => { | ||
cy.visit('/s/random'); | ||
cy.location().should(loc => { | ||
expect(loc.pathname).to.eq('/'); | ||
}) | ||
}) | ||
}) | ||
}); | ||
|
||
context('s/[id]/edit.js', () => { | ||
it('works', () => cy.visit("/s/random/edit")); | ||
context('if story does not exist', () => { | ||
it('redirects to /index.js', () => { | ||
cy.visit('/s/random/edit'); | ||
cy.location().should(loc => { | ||
expect(loc.pathname).to.eq('/'); | ||
}) | ||
}) | ||
}) | ||
}); | ||
|
||
context('stories.js', () => { | ||
it('works', () => cy.visit("/stories")) | ||
context('if user is not logged in', () => { | ||
it('redirects to /index.js', () => { | ||
cy.visit('/stories'); | ||
cy.location().should(loc => { | ||
expect(loc.pathname).to.eq('/'); | ||
}) | ||
}) | ||
}) | ||
}); | ||
|
||
context('theme.js', () => { | ||
it('works', () => cy.visit("/theme")) | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters