My service involves loading a variable from a JavaScript file fetched from a CDN (without a typedef).
To handle this, I have created a declaration for the variable:
declare const externalValue: string;
@Injectable()
export class Service {
...
Everything seems to be going smoothly until I try to test my service and encounter the following error message:
ReferenceError: externalValue is not defined
This error is understandable as the index.html file where the JavaScript file is loaded has not been called.
My question now is how can I mock this value when I am testing my service?