"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const supertest_1 = __importDefault(require("supertest"));
const chai_1 = require("chai");
const routes_1 = __importDefault(require("../../../src/routes"));
describe('Validate Route', function () {
    const request = (0, supertest_1.default)(routes_1.default);
    it('should detect valid block height', done => {
        request.get('/api/BTC/regtest/valid/100000')
            .expect(200, (err, res) => {
            if (err)
                console.error(err);
            const { isValid, type } = res.body;
            (0, chai_1.expect)(isValid).to.be.true;
            (0, chai_1.expect)(type).to.equal('blockOrTx');
            done();
        });
    });
    it('should detect valid block hash', done => {
        request.get('/api/BTC/regtest/valid/4fedb28fb20b5dcfe4588857ac10c38c6d67e8267e35478d8bcca468c9114bbe')
            .expect(200, (err, res) => {
            if (err)
                console.error(err);
            const { isValid, type } = res.body;
            (0, chai_1.expect)(isValid).to.be.true;
            (0, chai_1.expect)(type).to.equal('blockOrTx');
            done();
        });
    });
    it('should detect invalid block hash when length < 64', done => {
        request.get('/api/BTC/regtest/valid/4fedb28fb20b5dcfe4588857ac10c38c6d67e8267e35478d8bcca468c9114bb')
            .expect(200, (err, res) => {
            if (err)
                console.error(err);
            const { isValid, type } = res.body;
            (0, chai_1.expect)(isValid).to.be.false;
            (0, chai_1.expect)(type).to.equal('invalid');
            done();
        });
    });
    it('should detect invalid block hash when length > 64', done => {
        request.get('/api/BTC/regtest/valid/4fedb28fb20b5dcfe4588857ac10c38c6d67e8267e35478d8bcca468c9114bbee')
            .expect(200, (err, res) => {
            if (err)
                console.error(err);
            const { isValid, type } = res.body;
            (0, chai_1.expect)(isValid).to.be.false;
            (0, chai_1.expect)(type).to.equal('invalid');
            done();
        });
    });
    it('should detect valid bitcoin address', done => {
        request.get('/api/BTC/regtest/valid/bcrt1qqf8mswxuh4fgv27e47lekxxt0jgp373zg85jk4')
            .expect(200, (err, res) => {
            if (err)
                console.error(err);
            const { isValid, type } = res.body;
            (0, chai_1.expect)(isValid).to.be.true;
            (0, chai_1.expect)(type).to.equal('addr');
            done();
        });
    });
    it('should detect invalid bitcoin address', done => {
        request.get('/api/BTC/regtest/valid/bcrt1qqf8mswxuh4fgv27e47lekxxt0jgp373zg85jk44')
            .expect(200, (err, res) => {
            if (err)
                console.error(err);
            const { isValid, type } = res.body;
            (0, chai_1.expect)(isValid).to.be.false;
            (0, chai_1.expect)(type).to.equal('invalid');
            done();
        });
    });
});
//# sourceMappingURL=valid.test.js.map