Skip to content

Commit

Permalink
sdk: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maany committed Jul 14, 2023
1 parent 4037f85 commit 34d7647
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/lib/core/use-case/list-dids/list-dids-usecase2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ListDIDsViewModel } from "@/lib/infrastructure/data/view-model/list-did
import GetDIDsPipelineElement from "./pipeline-element-get-did";

@injectable()
class ListDIDsUseCase extends BaseMultiCallStreamableUseCase<ListDIDsRequest, ListDIDsResponse, ListDIDsError, ListDIDDTO, ListDIDsStreamData, DIDDTO, ListDIDsViewModel> implements ListDIDsInputPort {
class ListDIDsUseCase extends BaseMultiCallStreamableUseCase<ListDIDsRequest, ListDIDsResponse, ListDIDsError, ListDIDDTO, DIDDTO, ListDIDsViewModel> implements ListDIDsInputPort {

constructor(
protected presenter: ListDIDsOutputPort,
Expand Down
1 change: 0 additions & 1 deletion src/lib/sdk/usecase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ export abstract class BaseMultiCallStreamableUseCase<
TResponseModel extends BaseResponseModel,
TErrorModel extends BaseErrorResponseModel,
TDTO extends BaseStreamableDTO,
TStreamData,
TStreamDTO extends BaseDTO,
TViewModel extends BaseViewModel
>
Expand Down
2 changes: 0 additions & 2 deletions test/sdk/post-processing-streaming-pipeline/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export interface TResponseModel extends BaseResponseModel {
message: string
}

export type StreamData = string

export interface StreamDTO extends BaseDTO {
status: 'success' | 'error'
title: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { BaseStreamingPostProcessingPipelineElement } from '@/lib/sdk/postprocessing-pipeline-elements'
import { Readable, Transform, PassThrough } from 'stream'
import { MockHttpStreamableResponseFactory } from 'test/fixtures/http-fixtures'
import { RequestModel, StreamData, StreamDTO, TResponseModel } from './models'
import { RequestModel, StreamDTO, TResponseModel } from './models'
import {
FirstPipelineElement,
SecondPipelineElement,
Expand All @@ -23,7 +23,6 @@ describe('BaseMultiCallStreamableUseCase', () => {
TResponseModel,
BaseErrorResponseModel,
BaseStreamableDTO,
StreamData,
StreamDTO,
BaseViewModel
> {
Expand All @@ -45,20 +44,23 @@ describe('BaseMultiCallStreamableUseCase', () => {
makeGatewayRequest(requestModel: {
rucioAuthToken: string
}): Promise<BaseStreamableDTO> {
const mockDTOs: StreamDTO[] = [
{
status: 'success',
title: 'root_element_1',
},
{
status: 'success',
title: 'root_element_2',
},
]
const dto: BaseStreamableDTO = {
status: 'success',
stream: Readable.from(['root_element_1', 'root_element_2']),
stream: Readable.from(mockDTOs),
}
return Promise.resolve(dto)
}

streamDataToStreamDTO(streamedData: StreamData, requestModel?: { rucioAuthToken: string } | undefined): StreamDTO {
return {
status: 'success',
title: streamedData,
}
}

handleGatewayError(error: BaseStreamableDTO): BaseErrorResponseModel {
throw new Error('Method not implemented.')
}
Expand Down

0 comments on commit 34d7647

Please sign in to comment.