(storedString, experimentId, opt_on)
| 236 | }); |
| 237 | |
| 238 | function expectToggle(storedString, experimentId, opt_on) { |
| 239 | resetExperimentTogglesForTesting(window); |
| 240 | const win = { |
| 241 | document: {}, |
| 242 | localStorage: fakeLocalStorage({'amp-experiment-toggles': storedString}), |
| 243 | location: { |
| 244 | hostname: 'test.test', |
| 245 | href: 'https://test.test/test.html', |
| 246 | }, |
| 247 | }; |
| 248 | const on = toggleExperiment(win, experimentId, opt_on); |
| 249 | const newString = win.localStorage.getItem('amp-experiment-toggles'); |
| 250 | // eslint-disable-next-line chai-expect/missing-assertion |
| 251 | return expect(`${on}; ${newString}`); |
| 252 | } |
| 253 | |
| 254 | it('should toggle to "on" with no cookies, malformed or empty', () => { |
| 255 | expectToggle(null, 'e1').to.equal('true; e1'); |
no test coverage detected