How to mock environment files import in unit tests

前端 未结 3 1372
花落未央
花落未央 2021-02-19 13:11

In our angular app, we use environment files to load some config.

environment.ts

export const environment = {
  production: false,
  defaultLocale: \'en         


        
3条回答
  •  星月不相逢
    2021-02-19 13:38

    Something like this worked for me:

    it('should test', () => {
      environment.defaultLocale = ;
    
      const result = service.method();
    
      expect(result).toEqual();
    });
    

提交回复
热议问题