This repository has been archived by the owner on Dec 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed most errors in the AppComponent test
- Loading branch information
Showing
5 changed files
with
66 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
import 'jest-preset-angular'; | ||
|
||
import * as nodeCrypto from 'crypto'; | ||
Object.defineProperty(global, 'crypto', { | ||
value: { | ||
getRandomValues: buffer => nodeCrypto.randomFillSync(buffer) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { Injectable } from "@angular/core"; | ||
|
||
export const { IonicModule } = jest.requireActual('@ionic/angular'); | ||
|
||
@Injectable() | ||
export class Platform { | ||
ready = jest.fn(); | ||
|
||
constructor() { | ||
this.ready.mockReturnValue(Promise.resolve()); | ||
} | ||
} | ||
|
||
@Injectable() | ||
export class ToastController { | ||
create = jest.fn(); | ||
|
||
constructor() { | ||
this.create.mockReturnValue(Promise.resolve()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
import { Pipe, PipeTransform } from "@angular/core"; | ||
import { Injectable, Pipe, PipeTransform } from "@angular/core"; | ||
|
||
@Pipe({name: 'translate'}) | ||
export class TranslatePipe implements PipeTransform { | ||
transform(value: any): any { | ||
return value; | ||
} | ||
} | ||
|
||
@Injectable() | ||
export class TranslateService { | ||
setDefaultLang = jest.fn(); | ||
use = jest.fn(); | ||
getBrowserLang = jest.fn(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters