Skip to content

Commit 6a2f7c5

Browse files
committed
fix test related to use new file api refactor
1 parent bcf4192 commit 6a2f7c5

File tree

4 files changed

+67
-8
lines changed

4 files changed

+67
-8
lines changed

src/app/shared/capacitor-plugins/mock-app-plugin.ts

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,47 @@ export class MockAppPlugin implements AppPlugin {
2020
throw new Error('Method not implemented.');
2121
}
2222

23+
// addListener(
24+
// eventName: 'appStateChange',
25+
// listenerFunc: StateChangeListener
26+
// ): Promise<PluginListenerHandle> & PluginListenerHandle;
27+
// addListener(
28+
// eventName: 'appUrlOpen',
29+
// listenerFunc: URLOpenListener
30+
// ): Promise<PluginListenerHandle> & PluginListenerHandle;
31+
// addListener(
32+
// eventName: 'appRestoredResult',
33+
// listenerFunc: RestoredListener
34+
// ): Promise<PluginListenerHandle> & PluginListenerHandle;
35+
// addListener(
36+
// eventName: 'backButton',
37+
// listenerFunc: BackButtonListener
38+
// ): Promise<PluginListenerHandle> & PluginListenerHandle;
39+
// addListener(
40+
// _eventName: any,
41+
// _listenerFunc: any
42+
// ): Promise<PluginListenerHandle> & PluginListenerHandle {
43+
// // eslint-disable-next-line @typescript-eslint/no-empty-function
44+
// const remove = async () => {};
45+
// const listenerHandler: any = Promise.resolve({ remove });
46+
// Object.defineProperty(listenerHandler, 'remove', {
47+
// value: async () => Promise.resolve({ remove }),
48+
// });
49+
// return listenerHandler;
50+
// }
51+
2352
addListener(
2453
eventName: 'appStateChange',
2554
listenerFunc: StateChangeListener
2655
): Promise<PluginListenerHandle> & PluginListenerHandle;
56+
addListener(
57+
eventName: 'pause',
58+
listenerFunc: () => void
59+
): Promise<PluginListenerHandle> & PluginListenerHandle;
60+
addListener(
61+
eventName: 'resume',
62+
listenerFunc: () => void
63+
): Promise<PluginListenerHandle> & PluginListenerHandle;
2764
addListener(
2865
eventName: 'appUrlOpen',
2966
listenerFunc: URLOpenListener
@@ -36,10 +73,7 @@ export class MockAppPlugin implements AppPlugin {
3673
eventName: 'backButton',
3774
listenerFunc: BackButtonListener
3875
): Promise<PluginListenerHandle> & PluginListenerHandle;
39-
addListener(
40-
_eventName: any,
41-
_listenerFunc: any
42-
): Promise<PluginListenerHandle> & PluginListenerHandle {
76+
async addListener(_: unknown, __: unknown): Promise<PluginListenerHandle> {
4377
// eslint-disable-next-line @typescript-eslint/no-empty-function
4478
const remove = async () => {};
4579
const listenerHandler: any = Promise.resolve({ remove });

src/app/shared/capacitor-plugins/mock-camera-plugin.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ export class MockCameraPlugin implements CameraPlugin {
2626
throw new Error('Method not implemented.');
2727
}
2828

29+
async pickLimitedLibraryPhotos(): Promise<GalleryPhotos> {
30+
throw new Error('Method not implemented.');
31+
}
32+
33+
async getLimitedLibraryPhotos(): Promise<GalleryPhotos> {
34+
throw new Error('Method not implemented.');
35+
}
36+
2937
addListener(
3038
_eventName: string,
3139
_listenerFunc: () => any

src/app/shared/capacitor-plugins/mock-filesystem-plugin.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { PluginListenerHandle } from '@capacitor/core';
44
import {
55
AppendFileOptions as FileAppendOptions,
66
CopyOptions,
7+
CopyResult,
78
DeleteFileOptions as FileDeleteOptions,
9+
FileInfo,
810
FilesystemPlugin,
911
GetUriOptions,
1012
GetUriResult,
@@ -88,9 +90,13 @@ export class MockFilesystemPlugin implements FilesystemPlugin {
8890
return { files: [] };
8991
}
9092
return {
91-
files: directory.map(filePath =>
92-
filePath.replace(RegExp(`^${targetDirectory}`), '')
93-
),
93+
files: directory.map<FileInfo>(filePath => ({
94+
name: filePath.replace(RegExp(`^${targetDirectory}`), ''),
95+
type: 'file',
96+
uri: filePath.replace(RegExp(`^${targetDirectory}`), ''),
97+
mtime: 0,
98+
size: 0,
99+
})),
94100
};
95101
}
96102

@@ -106,7 +112,7 @@ export class MockFilesystemPlugin implements FilesystemPlugin {
106112
throw new Error('Method not implemented.');
107113
}
108114

109-
async copy(_: CopyOptions): Promise<void> {
115+
async copy(_: CopyOptions): Promise<CopyResult> {
110116
throw new Error('Method not implemented.');
111117
}
112118

src/app/shared/capacitor-plugins/mock-local-notifications-plugin.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ActionPerformed as LocalNotificationActionPerformed,
66
ActionType as LocalNotificationActionType,
77
Channel as NotificationChannel,
8+
DeliveredNotifications,
89
EnabledResult as LocalNotificationEnabledResult,
910
ListChannelsResult as NotificationChannelList,
1011
LocalNotificationSchema as LocalNotification,
@@ -81,4 +82,14 @@ export class MockLocalNotificationsPlugin implements LocalNotificationsPlugin {
8182
async removeAllListeners(): Promise<void> {
8283
throw new Error('Method not implemented.');
8384
}
85+
86+
async getDeliveredNotifications(): Promise<DeliveredNotifications> {
87+
throw new Error('Method not implemented.');
88+
}
89+
async removeDeliveredNotifications(_: DeliveredNotifications): Promise<void> {
90+
throw new Error('Method not implemented.');
91+
}
92+
async removeAllDeliveredNotifications(): Promise<void> {
93+
throw new Error('Method not implemented.');
94+
}
8495
}

0 commit comments

Comments
 (0)