import { http, HttpResponse } from "msw";
import { ResponseStatus } from "../src/blockchainClient/enums";
import { blockDataResponse } from "../resources/testData";
const blockchainRid = "D7AE4988E9FCAC470D1B5AB9CD04A79BFE165AB616B4D038C2ED944BA2461212";
const exampleTxHashString = "834ba9e86285875cd0c4f2ff2605db1ed921a1dcd47c873916d99e06f8874f5a";
const rejectReason = "[bc-rid=8E:DFB4, chain-id=0] Operation 'news_feed_ch5.news_feed:make_post' failed: Expected at least two operations, make sure that you included auth";
const invalidFormatRejectReason = "Operation 'news_feed_ch5.news_feed:make_post' failed: Expected at least two operations, make sure that you included auth";
const faultyBrid = "60B01AD60DD4476E2DB5141B0848B9F350D4F6F7C7F6EE5421EFC9968FF5874C";
export const handlers = [
    http.post(`http://localhost/tx/${blockchainRid}`, () => {
        return HttpResponse.json({});
    }),
    http.get(`http://localhost/tx/${blockchainRid}/${exampleTxHashString}/status`, () => {
        const responseBody = {
            status: ResponseStatus.Confirmed,
        };
        return HttpResponse.json(responseBody);
    }),
    http.get(`http://localhost/blocks/${blockchainRid}/height/*`, () => {
        return HttpResponse.json(blockDataResponse);
    }),
    http.get(`http://localhost/blocks/${blockchainRid}`, () => {
        return HttpResponse.json([blockDataResponse]);
    }),
];
const responseBody = {
    status: ResponseStatus.Rejected,
    rejectReason,
};
const responseBodyInvalidRejectError = {
    status: ResponseStatus.Rejected,
    rejectReason: invalidFormatRejectReason,
};
export const errorHandler = {
    txError: http.post(`http://localhost/tx/${blockchainRid}`, () => {
        return new HttpResponse('{"error": "Could not parse JSON"}', {
            status: 400,
        });
    }, { once: true }),
    txStatusInvalidRejectFormat: http.get(`http://localhost/tx/${blockchainRid}/${exampleTxHashString}/status`, () => {
        return HttpResponse.json(responseBodyInvalidRejectError);
    }, { once: true }),
    statusRejected: http.get(`http://localhost/tx/${blockchainRid}/${exampleTxHashString}/status`, () => {
        return HttpResponse.json(responseBody);
    }, { once: true }),
    statusWaiting: http.get(`http://localhost/tx/${blockchainRid}/${exampleTxHashString}/status`, () => {
        return HttpResponse.json({
            status: ResponseStatus.Waiting,
        });
    }),
    statusUnknown: http.get(`http://localhost/tx/${blockchainRid}/${exampleTxHashString}/status`, () => {
        return HttpResponse.json({
            status: ResponseStatus.Unknown,
        });
    }),
    getTransactionInfo: http.get(`http://localhost/transactions/*`, () => {
        return new HttpResponse(`{"error":"Can't find blockchain with blockchainRID: ${faultyBrid}"}`, {
            status: 404,
        });
    }, { once: true }),
};
//# sourceMappingURL=handlers.js.map