Created
May 27, 2023 12:55
-
-
Save AlejoDev95/e0da185edb9f3bc6e8ae9952d335c530 to your computer and use it in GitHub Desktop.
Grupo de funciones que nos van a permitir trabajar con procesos asincronos en nuestras pruebas unitarias
This file contains hidden or 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
import { defer, of } from 'rxjs'; | |
export function asyncData<T>(data: T) { | |
return defer(() => Promise.resolve(data)); | |
} | |
export function asyncError(error: unknown) { | |
return defer(() => Promise.reject(error)); | |
} | |
export function mockObservable<T>(data: T) { | |
return of(data); | |
} | |
export function mockPromise<T>(data: T) { | |
return Promise.resolve(data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment