(url, targetDomain, opt_allowProxyOrigin)
| 143 | |
| 144 | it('should write the cookie to the right domain on origin', () => { |
| 145 | function test(url, targetDomain, opt_allowProxyOrigin) { |
| 146 | expect(doc.cookie).to.equal(''); |
| 147 | win.location = url; |
| 148 | setCookie(win, 'c&1', 'v&1', Date.now() + BASE_CID_MAX_AGE_MILLIS, { |
| 149 | highestAvailableDomain: true, |
| 150 | allowOnProxyOrigin: opt_allowProxyOrigin, |
| 151 | }); |
| 152 | expect(doc.lastSetCookieRaw).to.equal( |
| 153 | `c%261=v%261; path=/; domain=${targetDomain}; ` + |
| 154 | 'expires=Tue, 01 Jan 2019 08:00:00 GMT' |
| 155 | ); |
| 156 | expect(doc.cookie).to.equal('c%261=v%261'); |
| 157 | // Erase cookie |
| 158 | setCookie(win, 'c&1', 'v&1', Date.now() - 1000, { |
| 159 | highestAvailableDomain: true, |
| 160 | allowOnProxyOrigin: opt_allowProxyOrigin, |
| 161 | }); |
| 162 | expect(doc.cookie).to.equal(''); |
| 163 | } |
| 164 | |
| 165 | //example.com |
| 166 | test('https://www.example.com/test.html', 'example.com'); |
no test coverage detected