"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
require("mocha");
require("chai");
const chai_1 = require("chai");
const path = require("path");
const filehound_1 = require("filehound");
describe("when a recursive file search is run", () => {
    it("then it shall find matching files", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
        return new Promise((resolve, reject) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
            try {
                let searchPath = path.join(process.cwd(), "src/test", "mock-a");
                console.log(`Searching ${searchPath}...`);
                let files = yield filehound_1.FileHound.create()
                    .path(searchPath)
                    .glob("Dockerfile", "*.dockerfile")
                    .ignoreHiddenDirectories()
                    .discard("ignored*|dist|bin")
                    // .includeFileStats()
                    .find();
                // files.forEach(element => {
                //   element = path.relative(searchPath, element);
                // });
                files = files.map(file => path.relative(searchPath, file));
                console.dir(files);
                resolve();
            }
            catch (err) {
                reject(err);
            }
        }));
    }));
    it("then paths shall be compared on how they resolve", () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
        return new Promise((resolve, reject) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
            try {
                let searchPath = path.join(process.cwd(), "src/test", "mock-a");
                console.log(`Searching ${searchPath}...`);
                let fileA = "./Dockerfile";
                let fileB = "dockerfile";
                let relA = path.relative(searchPath, path.join(searchPath, fileA)).toLowerCase();
                let relB = path.relative(searchPath, path.join(searchPath, fileB)).toLowerCase();
                console.log(`relA: ${relA}`);
                console.log(`relB: ${relB}`);
                let inUse = [relB].indexOf(relA) >= 0;
                (0, chai_1.expect)(inUse).to.equal(true, "Path A must match Path B");
                resolve();
            }
            catch (err) {
                reject(err);
            }
        }));
    }));
});
//# sourceMappingURL=when-a-recursive-file-search-is-run.spec.js.map