import BatchRequest from "../../../src/common/batch/BatchRequest" ; import SerializationResponseMockStrings from "./mock.response.serialization.strings" ; import SerializationBatchOperationFactory from "./mock.serialization.batchoperation.factory" ; import * as Models from "../../../src/table/generated/artifacts/models" ; import toReadableStream from "to-readable-stream" ; export default class SerializationObjectForBatchRequestFactory { public static GetBatchRequestForQueryWithPartitionandRowKeyResponseMock ( ) { const mockRequest = new BatchRequest ( SerializationBatchOperationFactory . GetBatchOperationMockForQueryEntityWithPartitionKeyAndRowKey ( SerializationResponseMockStrings . EmptyHeaderMock ) ) ; return mockRequest ; } public static GetBatchRequestForSingleInsertResponseMock ( ) { const mockRequest = new BatchRequest ( SerializationBatchOperationFactory . GetBatchOperationMockForInsertSingleEntity ( SerializationResponseMockStrings . EmptyHeaderMock ) ) ; return mockRequest ; } public static GetBatchRequestForSingleDeletetResponseMock ( ) { const mockRequest = new BatchRequest ( SerializationBatchOperationFactory . GetBatchOperationMockForDeleteSingleEntity ( SerializationResponseMockStrings . EmptyHeaderMock ) ) ; return mockRequest ; } public static GetBatchOperationMockForSingleInsert ( ) { const responseObject = new Object ( ) as Models . TableInsertEntityResponse ; responseObject . eTag = 'W/"datetime\'2021-02-12T08%3A28%3A27.47468Z\'"' ; responseObject . statusCode = 204 ; return responseObject as Models . TableInsertEntityResponse ; } public static GetBatchOperationMockForSingleDelete ( ) { const responseObject = new Object ( ) as Models . TableDeleteEntityResponse ; responseObject . statusCode = 204 ; return responseObject as Models . TableDeleteEntityResponse ; } public static GetBatchTableQueryEntitiesWithPartitionAndRowKeyResponseMock ( ) { const responseObject = new Object ( ) as Models . TableQueryEntitiesWithPartitionAndRowKeyResponse ; responseObject . clientRequestId = "" ; responseObject . requestId = "" ; responseObject . version = "" ; responseObject . date = new Date ( ) ; responseObject . eTag = 'W/"datetime\'2021-02-05T17%3A15%3A16.7935715Z\'"' ; responseObject . xMsContinuationNextPartitionKey = "" ; responseObject . xMsContinuationNextRowKey = "" ; responseObject . errorCode = "" ; responseObject . body = toReadableStream ( '{"odata.metadata":"https://azuritetesttarget.table.core.windows.net/$metadata#TestingAzurite/@Element",\
"odata.etag":"W/"datetime\'2021-02-05T17%3A15%3A16.7935715Z\'"","PartitionKey":"part1","RowKey":"row161254531681303585",\
"Timestamp":"2021-02-05T17:15:16.7935715Z","myValue":"value1"}' ) ; responseObject . statusCode = 200 ; return responseObject as Models . TableQueryEntitiesWithPartitionAndRowKeyResponse ; } }