Skip to content

Commit 2c14c21

Browse files
committed
remove redundant mock, reuse existing one
1 parent 2669471 commit 2c14c21

1 file changed

Lines changed: 3 additions & 85 deletions

File tree

src/views/manage-solution/manage-solution-webview-main.factories.ts

Lines changed: 3 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ import { openFileExternalFactory } from '../../open-file-external.factories';
3030
import { ETextFileResult } from '../../generic/text-file';
3131
import { SolutionData } from './view/state/manage-solution-state';
3232
import { ManageSolutionController } from './manage-solution-controller';
33-
import { ApplyParams, BoardInfo, BoardList, ContextInfo, ConvertSolutionParams, ConvertSolutionResult, CsolutionService, CtRoot, DeviceInfo, DeviceList, DiscoverLayersInfo, DraftProjectsInfo, GetBoardInfoParams, GetBoardListParams, GetComponentsTreeParams, GetContextInfoParams, GetDeviceInfoParams, GetDeviceListParams, GetDraftProjectsParams, GetPacksInfoParams, GetUsedItemsParams, GetVariablesParams, GetVersionResult, ListMissingPacksResult, LoadSolutionParams, LogMessages, PacksInfo, ResolveParams, Results, SelectBundleParams, SelectComponentParams, SelectPackParams, SelectVariantParams, SuccessResult, UsedItems, ValidateComponentsParams, VariablesResult } from '../../json-rpc/csolution-rpc-client';
33+
import { CsolutionService } from '../../json-rpc/csolution-rpc-client';
34+
import { csolutionServiceFactory } from '../../json-rpc/csolution-rpc-client.factory';
3435

3536
export type ManageSolutionWebviewMainFactoryOptions = {
3637
solutionManager?: SolutionManager;
@@ -81,90 +82,7 @@ export function manageSolutionWebviewMainFactory(options?: ManageSolutionWebview
8182
options?.commandsProvider ?? commandsProviderFactory(),
8283
options?.openFileExternal ?? openFileExternalFactory(),
8384
options?.configurationProvider ?? configurationProviderFactory(),
84-
options?.csolutionService ?? jest.mocked<CsolutionService>({
85-
getDeviceList: async function (_args: GetDeviceListParams): Promise<DeviceList> { throw new Error('Function not implemented.'); },
86-
activate: function (_context: Pick<vscode.ExtensionContext, 'subscriptions'>): Promise<void> {
87-
return Promise.resolve();
88-
},
89-
getCsolutionBin: function (): string {
90-
throw new Error('Function not implemented.');
91-
},
92-
waitForExit: function (): Promise<void> {
93-
throw new Error('Function not implemented.');
94-
},
95-
getVariables: function (_args: GetVariablesParams): Promise<VariablesResult> {
96-
throw new Error('Function not implemented.');
97-
},
98-
getVersion: function (): Promise<GetVersionResult> {
99-
throw new Error('Function not implemented.');
100-
},
101-
shutdown: function (): Promise<SuccessResult> {
102-
throw new Error('Function not implemented.');
103-
},
104-
apply: function (_args: ApplyParams): Promise<SuccessResult> {
105-
throw new Error('Function not implemented.');
106-
},
107-
resolve: function (_args: ResolveParams): Promise<SuccessResult> {
108-
throw new Error('Function not implemented.');
109-
},
110-
loadPacks: function (): Promise<SuccessResult> {
111-
throw new Error('Function not implemented.');
112-
},
113-
loadSolution: function (_args: LoadSolutionParams): Promise<SuccessResult> {
114-
throw new Error('Function not implemented.');
115-
},
116-
getPacksInfo: function (_args: GetPacksInfoParams): Promise<PacksInfo> {
117-
throw new Error('Function not implemented.');
118-
},
119-
selectPack: function (_args: SelectPackParams): Promise<SuccessResult> {
120-
throw new Error('Function not implemented.');
121-
},
122-
getUsedItems: function (_args: GetUsedItemsParams): Promise<UsedItems> {
123-
throw new Error('Function not implemented.');
124-
},
125-
getContextInfo: function (_args: GetContextInfoParams): Promise<ContextInfo> {
126-
throw new Error('Function not implemented.');
127-
},
128-
getDeviceInfo: function (_args: GetDeviceInfoParams): Promise<DeviceInfo> {
129-
throw new Error('Function not implemented.');
130-
},
131-
getBoardList: function (_args: GetBoardListParams): Promise<BoardList> {
132-
throw new Error('Function not implemented.');
133-
},
134-
getBoardInfo: function (_args: GetBoardInfoParams): Promise<BoardInfo> {
135-
throw new Error('Function not implemented.');
136-
},
137-
getComponentsTree: function (_args: GetComponentsTreeParams): Promise<CtRoot> {
138-
throw new Error('Function not implemented.');
139-
},
140-
selectComponent: function (_args: SelectComponentParams): Promise<SuccessResult> {
141-
throw new Error('Function not implemented.');
142-
},
143-
selectVariant: function (_args: SelectVariantParams): Promise<SuccessResult> {
144-
throw new Error('Function not implemented.');
145-
},
146-
selectBundle: function (_args: SelectBundleParams): Promise<SuccessResult> {
147-
throw new Error('Function not implemented.');
148-
},
149-
validateComponents: function (_args: ValidateComponentsParams): Promise<Results> {
150-
throw new Error('Function not implemented.');
151-
},
152-
getLogMessages: function (): Promise<LogMessages> {
153-
throw new Error('Function not implemented.');
154-
},
155-
getDraftProjects: function (_args: GetDraftProjectsParams): Promise<DraftProjectsInfo> {
156-
throw new Error('Function not implemented.');
157-
},
158-
convertSolution: function (_args: ConvertSolutionParams): Promise<ConvertSolutionResult> {
159-
throw new Error('Function not implemented.');
160-
},
161-
discoverLayers: function (_args: LoadSolutionParams): Promise<DiscoverLayersInfo> {
162-
throw new Error('Function not implemented.');
163-
},
164-
listMissingPacks: function (_args: LoadSolutionParams): Promise<ListMissingPacksResult> {
165-
throw new Error('Function not implemented.');
166-
}
167-
}),
85+
options?.csolutionService ?? csolutionServiceFactory(),
16886
options?.onEdit,
16987
(options?.webviewManager ?? getMockWebViewManager<OutgoingMessage>()) as unknown as WebviewManager<IncomingMessage, OutgoingMessage>);
17088

0 commit comments

Comments
 (0)