-
Notifications
You must be signed in to change notification settings - Fork 687
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #700 from SoftwareBrothers/fix/fix-gh-actions
Update Cypress GH Action, Fix appendForceRefresh local url issue
- Loading branch information
Showing
3 changed files
with
67 additions
and
5 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
53 changes: 53 additions & 0 deletions
53
src/frontend/components/actions/utils/append-force-refresh.spec.ts
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,53 @@ | ||
import { expect } from 'chai' | ||
|
||
import { appendForceRefresh } from './append-force-refresh' | ||
|
||
describe('appendForceRefresh', () => { | ||
it('should add ?refresh=true to url if url has no search params', () => { | ||
const oldUrl = '/resources/Test' | ||
|
||
const newUrl = appendForceRefresh(oldUrl) | ||
|
||
expect(newUrl).to.equal('/resources/Test?refresh=true') | ||
}) | ||
|
||
it('should add &refresh=true to url if url already has search params', () => { | ||
const oldUrl = '/resources/Test?param=test' | ||
|
||
const newUrl = appendForceRefresh(oldUrl) | ||
|
||
expect(newUrl).to.equal('/resources/Test?param=test&refresh=true') | ||
}) | ||
|
||
it('should add &refresh=true to url if url already has search params but custom search is passed', () => { | ||
const oldUrl = '/resources/Test?param=test' | ||
|
||
const newUrl = appendForceRefresh(oldUrl, 'other_param=test2') | ||
|
||
expect(newUrl).to.equal('/resources/Test?other_param=test2&refresh=true') | ||
}) | ||
|
||
it('should add ?refresh=true to url if url is a full url with no search params', () => { | ||
const oldUrl = 'http://example.com/resources/Test' | ||
|
||
const newUrl = appendForceRefresh(oldUrl) | ||
|
||
expect(newUrl).to.equal('http://example.com/resources/Test?refresh=true') | ||
}) | ||
|
||
it('should add &refresh=true to url if url is a full url with search params', () => { | ||
const oldUrl = 'http://example.com/resources/Test?param=test' | ||
|
||
const newUrl = appendForceRefresh(oldUrl) | ||
|
||
expect(newUrl).to.equal('http://example.com/resources/Test?param=test&refresh=true') | ||
}) | ||
|
||
it('should add &refresh=true to url if url is a full url with search params but custom search is passed', () => { | ||
const oldUrl = 'http://example.com/resources/Test?param=test' | ||
|
||
const newUrl = appendForceRefresh(oldUrl, 'other_param=test2') | ||
|
||
expect(newUrl).to.equal('http://example.com/resources/Test?other_param=test2&refresh=true') | ||
}) | ||
}) |
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