"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const constants_1 = require("../constants");
const lsp_server_1 = require("../lsp-server");
const data = fs_1.default
    .readFileSync(path_1.default.join(__dirname, `tests.csv`), 'utf8')
    .toString()
    .split('\n')
    .map(d => d
    .trim()
    .replace(/(\\r)?\\n/g, '\n')
    .replace(/\\t/g, '\t'));
describe(`Parser Test Suite`, () => {
    data.forEach((sql, index) => {
        it(`Test Case ${index + 1}`, () => {
            const result = doValidation(sql);
            if (result.length > 0) {
                fs_1.default.writeFileSync(path_1.default.join(__dirname, `.log`), `--- Test Case ${index + 1} ---\n${sql}\n\n`, { flag: 'a' });
            }
            (0, chai_1.expect)(result.length).to.equal(0);
        }).timeout(4000);
    });
});
function doValidation(sql) {
    const uri = 'test://test.sql';
    const textDocument = vscode_languageserver_textdocument_1.TextDocument.create(uri, constants_1.LANGUAGE_ID, 0, sql);
    const lspServer = new lsp_server_1.LSPServer();
    lspServer.warehouse.setParsingValue(textDocument);
    return lspServer.doValidation(textDocument);
}
//# sourceMappingURL=parser.test.js.map