mirror of
https://github.com/zoriya/react-native-background-downloader.git
synced 2025-12-06 06:56:10 +00:00
fix export initDownloader & tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import RNBackgroundDownloader, { initDownloader } from '../index'
|
||||
import RNBackgroundDownloader from '../index'
|
||||
import DownloadTask from '../lib/downloadTask'
|
||||
import { NativeModules, NativeEventEmitter } from 'react-native'
|
||||
|
||||
@@ -130,11 +130,17 @@ test('stop', () => {
|
||||
})
|
||||
|
||||
test('initDownloader', () => {
|
||||
return RNBackgroundDownloader.initDownloader()
|
||||
.then(res => {
|
||||
expect(RNBackgroundDownloaderNative.initDownloader).toHaveBeenCalled()
|
||||
expect(res).toBe(undefined)
|
||||
})
|
||||
jest.mock('react-native/Libraries/Utilities/Platform', () => {
|
||||
const Platform = jest.requireActual(
|
||||
'react-native/Libraries/Utilities/Platform'
|
||||
)
|
||||
Platform.OS = 'android'
|
||||
return Platform
|
||||
})
|
||||
|
||||
const res = RNBackgroundDownloader.initDownloader()
|
||||
expect(RNBackgroundDownloaderNative.initDownloader).toHaveBeenCalled()
|
||||
expect(res).toBe(undefined)
|
||||
})
|
||||
|
||||
test('checkForExistingDownloads', () => {
|
||||
|
||||
2
index.d.ts
vendored
2
index.d.ts
vendored
@@ -79,7 +79,7 @@ export type EnsureDownloadsAreRunning = () => Promise<void>;
|
||||
export interface InitDownloaderOptions {
|
||||
type?: 'parallel' | 'sequential' | null;
|
||||
}
|
||||
export type InitDownloader = (options: InitDownloaderOptions) => Promise<void>;
|
||||
export type InitDownloader = (options: InitDownloaderOptions) => undefined;
|
||||
|
||||
export interface DownloadOption {
|
||||
id: string;
|
||||
|
||||
Reference in New Issue
Block a user