This repository has been archived by the owner on Mar 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(visual-grid-client): now referrer is per checkWindow
- Loading branch information
1 parent
5906063
commit 4998285
Showing
5 changed files
with
43 additions
and
10 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
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
35 changes: 35 additions & 0 deletions
35
packages/visual-grid-client/test/unit/sdk/checkWindow.test.js
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,35 @@ | ||
'use strict'; | ||
const {describe, it} = require('mocha'); | ||
const {expect} = require('chai'); | ||
const makeCheckWindow = require('../../../src/sdk/checkWindow'); | ||
const makeTestContorler = require('../../../src/sdk/makeTestContorler'); | ||
|
||
describe('checkWindow', () => { | ||
it('handles fetchHeaders correctly', async () => { | ||
const fetchHeaders = {['User-Agent']: 'some agent'}; | ||
const checkWindow = makeCheckWindow({ | ||
testController: makeTestContorler({numOfTests: 0, logger: console}), | ||
createRGridDOMAndGetResourceMapping: () => {}, | ||
renderBatch: () => {}, | ||
waitForRenderedStatus: () => {}, | ||
renderInfo: {}, | ||
logger: console, | ||
getCheckWindowPromises: () => {}, | ||
setCheckWindowPromises: () => {}, | ||
browsers: [], | ||
wrappers: [], | ||
renderThroat: () => {}, | ||
testName: 'some test', | ||
openEyesPromises: () => {}, | ||
fetchHeaders, | ||
}); | ||
await checkWindow({resourceUrls: [], referrer: 'some referrer'}); | ||
expect(fetchHeaders).to.eql({Referer: 'some referrer', ['User-Agent']: 'some agent'}); | ||
|
||
await checkWindow({resourceUrls: []}); | ||
expect(fetchHeaders).to.eql({Referer: undefined, ['User-Agent']: 'some agent'}); | ||
|
||
await checkWindow({resourceUrls: [], referrer: 'some referrer 2'}); | ||
expect(fetchHeaders).to.eql({Referer: 'some referrer 2', ['User-Agent']: 'some agent'}); | ||
}); | ||
}); |