[AAE-4863] Fixed the async and done warning due to new version of Karma (#6938)

* [AAE-4863] Fixed the async and done warning due to new version of Karma

* Fixed lint error
This commit is contained in:
Sushmitha V
2021-04-22 11:05:13 +05:30
committed by GitHub
parent bf70e471ce
commit dd56588df8

View File

@@ -30,21 +30,20 @@ const preventAngularFromResetting = () => (TestBed.resetTestingModule = () => Te
const allowAngularToReset = () => (TestBed.resetTestingModule = resetTestingModule); const allowAngularToReset = () => (TestBed.resetTestingModule = resetTestingModule);
export const setupTestBed = (moduleDef: TestModuleMetadata) => { export const setupTestBed = (moduleDef: TestModuleMetadata) => {
beforeAll((done) => beforeAll((done) => {
(async () => {
localStorage.clear(); localStorage.clear();
sessionStorage.clear(); sessionStorage.clear();
resetTestingModule(); resetTestingModule();
preventAngularFromResetting(); preventAngularFromResetting();
TestBed.configureTestingModule(moduleDef); TestBed.configureTestingModule(moduleDef);
await TestBed.compileComponents(); TestBed.compileComponents()
.then(() => {
// prevent Angular from resetting testing module TestBed.resetTestingModule = () => TestBed;
TestBed.resetTestingModule = () => TestBed; done();
})() })
.then(done) .catch(done.fail);
.catch(done.fail) }
); );
afterAll(() => allowAngularToReset()); afterAll(() => allowAngularToReset());
}; };