(used)
| 40 | |
| 41 | describe('getScopedCid', () => { |
| 42 | function verifyClientIdApiInUse(used) { |
| 43 | viewerMock.sendMessageAwaitResponse.returns( |
| 44 | Promise.resolve('client-id-from-viewer') |
| 45 | ); |
| 46 | return api |
| 47 | .getScopedCid(used ? 'api-key' : undefined, 'AMP_ECID_GOOGLE') |
| 48 | .then((cid) => { |
| 49 | expect(cid).to.equal('client-id-from-viewer'); |
| 50 | const payload = { |
| 51 | 'scope': 'AMP_ECID_GOOGLE', |
| 52 | 'clientIdApi': used, |
| 53 | 'canonicalOrigin': 'http://localhost:9876', |
| 54 | }; |
| 55 | if (used) { |
| 56 | payload['apiKey'] = 'api-key'; |
| 57 | } |
| 58 | expect(viewerMock.sendMessageAwaitResponse).to.be.calledWith( |
| 59 | 'cid', |
| 60 | payload |
| 61 | ); |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | it('should use client ID API from api if everything great', () => { |
| 66 | return verifyClientIdApiInUse(true); |
no test coverage detected