CourseInsights / test / controller / InsightFacade.spec.ts
InsightFacade.spec.ts
Raw
import {
	IInsightFacade,
	InsightDatasetKind,
	InsightError,
	InsightResult,
	NotFoundError,
	ResultTooLargeError,
} from "../../src/controller/IInsightFacade";
import InsightFacade from "../../src/controller/InsightFacade";
import { clearDisk, getContentFromArchives, loadTestQuery } from "../TestUtil";

import { expect, use } from "chai";
import chaiAsPromised from "chai-as-promised";

use(chaiAsPromised);

export interface ITestQuery {
	title?: string; // Test case title
	input: unknown; // Query under test
	errorExpected: boolean; // Whether the query is expected to throw an error
	expected: any; // Expected result
	orderExpected: boolean;
	orderBy: string[];
}

describe("InsightFacadeNam", function () {
	let facade: IInsightFacade;
	// Declare datasets used in tests. You should add more datasets like this!
	let sections: string;
	let sectionsQuery: string;
	let noResKey: string;
	let noSections: string;
	let notCoursesFolder: string;
	let notEveryMfield: string;
	let notEverySfield: string;
	let notJsonFormat: string;
	let campus: string;
	let campusSmall: string;
	let campusIndex: string;
	let campusRoom: string;

	// let fiveK: string;
	// let fiveKminusOne: string;
	// let fiveKone: string;

	before(async function () {
		// This block runs once and loads the datasets.
		campus = await getContentFromArchives("campus.zip");
		sections = await getContentFromArchives("validSmallData.zip");
		sectionsQuery = await getContentFromArchives("pairCourses.zip");
		noResKey = await getContentFromArchives("noResKey.zip");
		noSections = await getContentFromArchives("noSections.zip");
		notCoursesFolder = await getContentFromArchives("notCoursesFolder.zip");
		notEveryMfield = await getContentFromArchives("notEveryMfield.zip");
		notEverySfield = await getContentFromArchives("notEverySfield.zip");
		notJsonFormat = await getContentFromArchives("notJsonFormat.zip");
		campusSmall = await getContentFromArchives("campusSmall.zip");
		campusIndex = await getContentFromArchives("campusIndex.zip");
		campusRoom = await getContentFromArchives("campusRoom.zip");
		// fiveK = await getContentFromArchives("fiveK.zip");
		// fiveKminusOne = await getContentFromArchives("fiveKminusOne.zip");
		// fiveKone = await getContentFromArchives("fiveKone.zip");
		// Just in case there is anything hanging around from a previous run of the test suite
		await clearDisk();
	});

	describe("AddDataset", function () {
		beforeEach(async function () {
			await clearDisk();
			facade = new InsightFacade();
		});

		it("should successfully add a dataset (first)", async function () {
			try {
				//const facade2: InsightFacade = new InsightFacade();
				const result = await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);
				//const result = await facade2.addDataset("ubc", campus, InsightDatasetKind.Rooms);
				expect(result).to.have.members(["ubc"]);
				// console.log(Object.fromEntries(facade2.getDataset()));

				// const fs = require("fs-extra");
				// const res = await fs.readJson("data/" + "ubc" + ".json");
				// console.log(res);
				// console.log(typeof res);
				// console.log(typeof res[0]);
				// console.log(res[0]);
				// console.log(res[0].avg);
				//console.log(res[0].getSectionField("avg")); //is wrong. saved class as object without class functions.
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully add a dataset (second)", async function () {
			try {
				const result = await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);
				expect(result).to.have.members(["ubc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should reject valid sections kind but invalid rooms dataset kind", async function () {
			try {
				await facade.addDataset("ubc", campus, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject valid rooms kind but invalid sections dataset kind", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Rooms);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should successfully add a small Rooms dataset", async function () {
			try {
				const result = await facade.addDataset("ubc", campusSmall, InsightDatasetKind.Rooms);
				expect(result).to.have.members(["ubc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully add a Rooms dataset with one bad index", async function () {
			try {
				const result = await facade.addDataset("ubc", campusIndex, InsightDatasetKind.Rooms);
				expect(result).to.have.members(["ubc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully add a Rooms dataset with one bad room", async function () {
			try {
				const result = await facade.addDataset("ubc", campusRoom, InsightDatasetKind.Rooms);
				expect(result).to.have.members(["ubc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully add a Sections dataset", async function () {
			try {
				const result = await facade.addDataset("ubc", sectionsQuery, InsightDatasetKind.Sections);
				expect(result).to.have.members(["ubc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully add a dataset chain", async function () {
			try {
				const result = await facade.addDataset("ubc", sections, InsightDatasetKind.Sections).then(async () => {
					return await facade.addDataset("ufc", sections, InsightDatasetKind.Sections);
				});
				expect(result).to.have.members(["ubc", "ufc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should reject with an empty dataset id Nam", async function () {
			try {
				await facade.addDataset("", sections, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject with an whitespace dataset id", async function () {
			try {
				await facade.addDataset("     ", sections, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject with a duplicate dataset id", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections).then(async () => {
					return await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);
				});
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject with a duplicate dataset id and not change set", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections).then(async () => {
					return await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);
				});
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
				try {
					const result = await facade.addDataset("ufc", sections, InsightDatasetKind.Sections);
					expect(result).to.have.members(["ubc", "ufc"]);
				} catch (mistake) {
					expect.fail(`Should not have thrown ${mistake}!`);
				}
			}
		});

		it("should reject with an underscore dataset id", async function () {
			try {
				await facade.addDataset("ubc_", sections, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject with not base64 string content", async function () {
			try {
				const content = "invalid content";
				await facade.addDataset("ubc", content, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should successfully add a dataset through disk, should save on disk", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);
				facade = new InsightFacade();
				const result = await facade.addDataset("ufc", sections, InsightDatasetKind.Sections);
				expect(result).to.have.members(["ubc", "ufc"]);
				const facadeTemp: IInsightFacade = new InsightFacade();
				const arr = await facadeTemp.addDataset("unc", sections, InsightDatasetKind.Sections);
				expect(arr).to.have.members(["ubc", "ufc", "unc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should reject content without result key", async function () {
			try {
				await facade.addDataset("ubc", noResKey, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject content without sections", async function () {
			try {
				await facade.addDataset("ubc", noSections, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject content without courses folder", async function () {
			try {
				await facade.addDataset("ubc", notCoursesFolder, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject content without every mfield", async function () {
			try {
				await facade.addDataset("ubc", notEveryMfield, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject content without every sfield", async function () {
			try {
				await facade.addDataset("ubc", notEverySfield, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject content without json format", async function () {
			try {
				await facade.addDataset("ubc", notJsonFormat, InsightDatasetKind.Sections);
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});
	});

	describe("RemoveDataset", function () {
		beforeEach(async function () {
			await clearDisk();
			facade = new InsightFacade();
		});

		it("should successfully remove a dataset (first)", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);

				const result = await facade.removeDataset("ubc");
				expect(result).to.be.equal("ubc");

				const arr = await facade.addDataset("unc", sections, InsightDatasetKind.Sections);
				expect(arr).to.have.members(["unc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully remove a dataset (second)", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);

				const result = await facade.removeDataset("ubc");
				expect(result).to.be.equal("ubc");

				const arr = await facade.addDataset("unc", sections, InsightDatasetKind.Sections);
				expect(arr).to.have.members(["unc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully remove partially a dataset chain", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections).then(async () => {
					return await facade.addDataset("ufc", sections, InsightDatasetKind.Sections);
				});

				const result = await facade.removeDataset("ubc");
				expect(result).to.be.equal("ubc");

				const arr = await facade.addDataset("unc", sections, InsightDatasetKind.Sections);
				expect(arr).to.have.members(["unc", "ufc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully remove a dataset chain", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections).then(async () => {
					return await facade.addDataset("ufc", sections, InsightDatasetKind.Sections);
				});

				await facade.removeDataset("ubc");
				const result = await facade.removeDataset("ufc");
				expect(result).to.be.equal("ufc");

				const arr = await facade.addDataset("unc", sections, InsightDatasetKind.Sections);
				expect(arr).to.have.members(["unc"]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should reject remove with an non-existing valid dataset id", async function () {
			try {
				await facade.removeDataset("ubc");
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(NotFoundError);
			}
		});

		// it("should reject remove with an non-existing valid dataset id after add", async function () {
		// 	//don't know why
		// 	try {
		// 		await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);
		// 		await facade.removeDataset("unc");
		// 		expect.fail("Should have thrown!");
		// 	} catch (err) {
		// 		expect(err).to.be.instanceOf(NotFoundError);
		// 	}
		// });

		it("should reject remove with an underscore id", async function () {
			try {
				await facade.removeDataset("ubc_");
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject remove with an empty id", async function () {
			try {
				await facade.removeDataset("");
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		it("should reject remove with a whitespace id", async function () {
			try {
				await facade.removeDataset("     ");
				expect.fail("Should have thrown!");
			} catch (err) {
				expect(err).to.be.instanceOf(InsightError);
			}
		});

		// it("should successfully remove a dataset from disk, cache", async function () {
		// 	//don't know why
		// 	try {
		// 		await facade
		// 			.addDataset("ubc", sections, InsightDatasetKind.Sections)
		// 			.then(async () => {
		// 				await facade.addDataset("ufc", sections, InsightDatasetKind.Sections);
		// 			})
		// 			.then(async () => {
		// 				await facade.addDataset("unc", sections, InsightDatasetKind.Sections);
		// 			});

		// 		await facade.removeDataset("ubc");

		// 		facade = new InsightFacade();
		// 		const result = await facade.removeDataset("ufc");
		// 		expect(result).to.be.equal("ufc");

		// 		const facadeTemp: IInsightFacade = new InsightFacade();
		// 		const arr = await facadeTemp.removeDataset("unc");
		// 		expect(arr).to.be.equal("unc");
		// 	} catch (err) {
		// 		expect.fail(`Should not have thrown ${err}!`);
		// 	}
		// });
	});

	describe("ListDatasets", function () {
		beforeEach(async function () {
			await clearDisk();
			facade = new InsightFacade();
		});

		it("should successfully list a dataset 0", async function () {
			try {
				const result = await facade.listDatasets();
				expect(result).to.deep.equal([]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully list a dataset 1", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);

				const result = await facade.listDatasets();
				expect(result).to.deep.equal([
					{
						id: "ubc",
						kind: InsightDatasetKind.Sections,
						numRows: 6,
					},
				]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully list a dataset 2", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections).then(async () => {
					return await facade.addDataset("ufc", sections, InsightDatasetKind.Sections);
				});

				const result = await facade.listDatasets();
				expect(result).to.deep.equal([
					{
						id: "ubc",
						kind: InsightDatasetKind.Sections,
						numRows: 6,
					},
					{
						id: "ufc",
						kind: InsightDatasetKind.Sections,
						numRows: 6,
					},
				]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully list a dataset 0 chain", async function () {
			try {
				const result = await facade.listDatasets();
				expect(result).to.deep.equal([]);
				const arr = await facade.listDatasets();
				expect(arr).to.deep.equal([]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully list a dataset 1 chain", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections);

				const expected = [
					{
						id: "ubc",
						kind: InsightDatasetKind.Sections,
						numRows: 6,
					},
				];

				const result = await facade.listDatasets();
				expect(result).to.deep.equal(expected);

				const arr = await facade.listDatasets();
				expect(arr).to.deep.equal(expected);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully list a dataset 2 chain", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections).then(async () => {
					return await facade.addDataset("ufc", sections, InsightDatasetKind.Sections);
				});

				const expected = [
					{
						id: "ubc",
						kind: InsightDatasetKind.Sections,
						numRows: 6,
					},
					{
						id: "ufc",
						kind: InsightDatasetKind.Sections,
						numRows: 6,
					},
				];

				const result = await facade.listDatasets();
				expect(result).to.deep.equal(expected);

				const arr = await facade.listDatasets();
				expect(arr).to.deep.equal(expected);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});

		it("should successfully list a dataset after removal", async function () {
			try {
				await facade.addDataset("ubc", sections, InsightDatasetKind.Sections).then(async () => {
					return await facade.addDataset("ufc", sections, InsightDatasetKind.Sections);
				});

				const expected = [
					{
						id: "ubc",
						kind: InsightDatasetKind.Sections,
						numRows: 6,
					},
					{
						id: "ufc",
						kind: InsightDatasetKind.Sections,
						numRows: 6,
					},
				];

				const result = await facade.listDatasets();
				expect(result).to.deep.equal(expected);

				await facade.removeDataset("ubc");

				const arr = await facade.listDatasets();
				expect(arr).to.deep.equal([
					{
						id: "ufc",
						kind: InsightDatasetKind.Sections,
						numRows: 6,
					},
				]);
			} catch (err) {
				expect.fail(`Should not have thrown ${err}!`);
			}
		});
	});

	describe("PerformQuery", function () {
		/**
		 * Loads the TestQuery specified in the test name and asserts the behaviour of performQuery.
		 *
		 * Note: the 'this' parameter is automatically set by Mocha and contains information about the test.
		 */
		async function checkQuery(this: Mocha.Context): Promise<void> {
			if (!this.test) {
				throw new Error(
					"Invalid call to checkQuery." +
						"Usage: 'checkQuery' must be passed as the second parameter of Mocha's it(..) function." +
						"Do not invoke the function directly."
				);
			}
			// Destructuring assignment to reduce property accesses
			const { input, expected, errorExpected, orderExpected, orderBy } = await loadTestQuery(this.test.title);
			//console.log(typeof input); input is an Object
			let result: InsightResult[] = []; // dummy value before being reassigned
			try {
				result = await facade.performQuery(input);
			} catch (err) {
				if (!errorExpected) {
					expect.fail(`performQuery threw unexpected error: ${err}`);
				}
				const errorClassMap: Record<string, any> = {
					InsightError,
					NotFoundError,
					ResultTooLargeError,
				};
				const expectedError = errorClassMap[expected];
				expect(err).to.be.instanceOf(expectedError);
				return;
			}
			if (errorExpected) {
				expect.fail(`performQuery resolved when it should have rejected with ${expected}`);
			}
			//expect(result).to.deep.equal(expected);
			expect(result).to.have.deep.members(expected);
			expect(result).to.have.length(expected.length);
			if (orderExpected) {
				const resultAvg = result.map((item) => orderBy.map((key) => item[key]));
				const expectedAvg = expected.map((item: InsightResult) => orderBy.map((key) => item[key]));
				expect(resultAvg).to.deep.equal(expectedAvg);
			}
			return;
		}

		before(async function () {
			facade = new InsightFacade();

			// Add the datasets to InsightFacade once.
			// Will *fail* if there is a problem reading ANY dataset.
			const loadDatasetPromises: Promise<string[]>[] = [
				facade.addDataset("sections", sectionsQuery, InsightDatasetKind.Sections),
			];

			try {
				await Promise.all(loadDatasetPromises);
			} catch (err) {
				throw new Error(`In PerformQuery Before hook, dataset(s) failed to be added. \n${err}`);
			}
		});

		after(async function () {
			await clearDisk();
		});

		// Examples demonstrating how to test performQuery using the JSON Test Queries.
		// The relative path to the query file must be given in square brackets.
		it("[valid/simpleTest.json] SELECT dept, avg WHERE avg > 97 Nam", checkQuery);
		it("[valid/asterixAll.json] asterisk around", checkQuery);
		it("[valid/asterixEnd.json]asterisk before", checkQuery);
		it("[valid/asterixNo.json] no asterisk, normal s comparison", checkQuery);
		it("[valid/asterixStart.json] asterisk after", checkQuery);
		it("[valid/complexTest.json] complex SELECT", checkQuery);
		it("[valid/unordered.json] no order in options", checkQuery); //the only test without order key
		// Reason why test suite couldn't catch 16th mutant is because 16th one was probably related to ordering
		it("[valid/emptyString.json] s comparision should accept any string without asterix", checkQuery);
		it("[valid/filterAND.json] SELECT with and", checkQuery);
		it("[valid/filterDoubleNOT.json] SELECT with double not", checkQuery);
		it("[valid/filterEQ.json] SELECT dept, avg WHERE avg = 97", checkQuery);
		it("[valid/filterLT.json] SELECT dept, avg WHERE avg < 97", checkQuery);
		it("[valid/filterNot.json] SELECT with not", checkQuery);
		it("[valid/filterOR.json] SELECT with or", checkQuery);
		it("[valid/simpleAND.json] simpleAND", checkQuery);
		it("[valid/simpleAudit.json] simpleAudit", checkQuery);
		it("[valid/simpleDept.json] simpleDept", checkQuery);
		it("[valid/simpleFail.json] simpleFail", checkQuery);
		it("[valid/simpleID.json] simpleID", checkQuery);
		it("[valid/simpleInstr.json] simpleInstr", checkQuery);
		it("[valid/simpleNOT.json] simpleNOT", checkQuery);
		it("[valid/simpleNumberBoundaryHundred.json] simpleNumberBoundaryHundred", checkQuery);
		it("[valid/simpleNumberBoundaryHundredOne.json] simpleNumberBoundaryHundredOne", checkQuery);
		it("[valid/simpleNumberBoundaryMinus.json] simpleNumberBoundaryMinus", checkQuery);
		it("[valid/simpleNumberBoundaryNineNine.json] simpleNumberBoundaryNineNine", checkQuery);
		it("[valid/simpleNumberBoundaryOne.json] simpleNumberBoundaryOne", checkQuery);
		it("[valid/simpleOR.json] simpleOR", checkQuery);
		it("[valid/simplePass.json] simplePass", checkQuery);
		it("[valid/simpleTitle.json] simpleTitle", checkQuery);
		it("[valid/simpleUUID.json] simpleUUID", checkQuery);
		it("[valid/contradictionShouldGiveNothing.json] contradictionShouldGiveNothing", checkQuery);
		it("[valid/contradictionShouldGiveNothingOR.json] contradictionShouldGiveNothingOR", checkQuery);
		it("[valid/nestedLogic.json] nestedLogic", checkQuery);
		it("[valid/notEverythingIsNothing.json] notEverythingIsNothing", checkQuery);
		it("[valid/overrideInvalidOptionsWithValidOptions.json] overrideInvalidOptionsWithValidOptions", checkQuery);
		it("[valid/overrideInvalidWhereWithValidWhere.json] overrideInvalidWhereWithValidWhere", checkQuery);
		it("[valid/oRDEROVERRIDE.json] oRDEROVERRIDE", checkQuery);
		it("[valid/oRDERANDCOLUMNSSWAPPED.json] oRDERANDCOLUMNSSWAPPED", checkQuery);
		it("[valid/repeatinColumnsIsOk.json] repeatinColumnsIsOk", checkQuery);
		it("[valid/reverseOptionsWhere.json] reverseOptionsWhere", checkQuery);
		it("[valid/zeroNumberIsAcceptable.json] zeroNumberIsAcceptable", checkQuery);
		it("[valid/aLLKEYSAlsoCheckThatItFlipsYearIfOVERALL.json] aLLKEYSAlsoCheckThatItFlipsYearIfOVERALL", checkQuery);
		it("[valid/fILTEROVERRIDE.json] fILTEROVERRIDE", checkQuery);
		it("[valid/negativeNumberIsAcceptable.json] negativeNumberIsAcceptable", checkQuery);
		it("[valid/onlyTwoAsterisk.json] onlyTwoAsterisk", checkQuery);
		it("[valid/onlyOneAsterisk.json] onlyOneAsterisk", checkQuery);
		it("[valid/simpleANDAdj.json] simpleANDAdj", checkQuery);
		it("[valid/simpleNOTAND.json] simpleNOTAND", checkQuery);
		it("[valid/simpleNOTANDSingle.json] simpleNOTANDSingle", checkQuery);
		it("[valid/simpleNOTOR.json] simpleNOTOR", checkQuery);
		it("[valid/simpleNOTORSingle.json] simpleNOTORSingle", checkQuery);
		it("[valid/simpleORUnion.json] simpleORUnion", checkQuery);
		it("[valid/bOTHWHEREOPTIONSOVERRIDE.json] bOTHWHEREOPTIONSOVERRIDE", checkQuery);
		it(
			"[valid/countsEveryCharacterWhitespaceTooInStrings.json] countsEveryCharacterWhitespaceTooInStrings",
			checkQuery
		);
		//it("[valid/simpleYear.json] simpleYear", checkQuery); //
		//it("[valid/takesExactlyFiveThousands.json] takesExactlyFiveThousands", checkQuery); //
		//it("[valid/takesExactlyFiveThousandsMinusOne.json] takesExactlyFiveThousandsMinusOne", checkQuery); //
		//it("[valid/aNDCanHaveOneKey.json] aNDCanHaveOneKey", checkQuery); //
		//it("[valid/oRCanHaveOneKey.json] oRCanHaveOneKey", checkQuery); //

		it("[invalid/missingWhere.json] Query missing WHERE", checkQuery);
		it("[invalid/missingOptions.json] Query missing OPTIONS", checkQuery);
		it("[invalid/largeError.json] More than loadable amount", checkQuery);
		it("[invalid/andFilterListEmpty.json] and is empty", checkQuery);
		it("[invalid/orFilterListEmpty.json] or is empty", checkQuery);
		it("[invalid/columnsEmpty.json] COLUMNS is empty", checkQuery);
		it("[invalid/doubleAsterisk.json] two consecutive asterisk", checkQuery);
		it("[invalid/middleAsterix.json] asterisk in the middle of string", checkQuery);
		it("[invalid/emptyIdString.json] empty id", checkQuery);
		it("[invalid/underscoreIdString.json] id with underscore", checkQuery);
		it("[invalid/invalidFilterFieldKeyNonExisting.json] key is not given in sfield/mfield", checkQuery);
		it("[invalid/invalidFilterFieldKeyType.json] mixed sfield and mfield", checkQuery);
		it("[invalid/invalidFilterKey.json] not a filter type", checkQuery);
		it("[invalid/invalidOptionsList.json] invalid options", checkQuery);
		it("[invalid/invalidTypeForM.json] string instad of number", checkQuery);
		it("[invalid/invalidTypeForS.json] number instad of string", checkQuery);
		it("[invalid/notObject.json] not acceptable format", checkQuery);
		it("[invalid/orderKeyNotInColumns.json] columns are ordered by not added key", checkQuery);
		it("[invalid/referencesNotAddedDataset.json] not existing dataset id", checkQuery);
		it("[invalid/referencesTwoDatasets.json]two dataset id's", checkQuery);
		it("[invalid/aNDMustBeANonEmptyArray.json] aNDMustBeANonEmptyArray", checkQuery);
		it("[invalid/aNDMustBeObject.json] aNDMustBeObject", checkQuery);
		it("[invalid/aNDShouldOnlyHaveOneKeyHasTwo.json] aNDShouldOnlyHaveOneKeyHasTwo", checkQuery);
		it("[invalid/aNDShouldOnlyHaveOneKeyHasZero.json] aNDShouldOnlyHaveOneKeyHasZero", checkQuery);
		it("[invalid/cOLUMNSMustBeANonEmptyArrayNotBrackets.json] cOLUMNSMustBeANonEmptyArrayNotBrackets", checkQuery);
		it("[invalid/cOLUMNSMustBeANonEmptyArrayNotFilter.json] cOLUMNSMustBeANonEmptyArrayNotFilter", checkQuery);
		it("[invalid/cOLUMNSMustBeANonEmptyArrayNotNull.json] cOLUMNSMustBeANonEmptyArrayNotNull", checkQuery);
		it("[invalid/columnsWithEmptyStringField.json] columnsWithEmptyStringField", checkQuery);
		it("[invalid/countsEveryCharacterWhitespaceToo.json] countsEveryCharacterWhitespaceToo", checkQuery);
		it("[invalid/countsEveryCharacterWhitespaceTooKeys.json] countsEveryCharacterWhitespaceTooKeys", checkQuery);
		it("[invalid/doesnTConverToUppercase.json] doesnTConverToUppercase", checkQuery);
		it("[invalid/doubleUnderscoreIsInvalid.json] doubleUnderscoreIsInvalid", checkQuery);
		it("[invalid/emptyJSON.json] emptyJSON", checkQuery);
		it("[invalid/excessKeysInQuery.json] excessKeysInQuery", checkQuery);
		it("[invalid/gTShouldOnlyHaveOneKeyHasTwo.json] gTShouldOnlyHaveOneKeyHasTwo", checkQuery);
		it("[invalid/gTShouldOnlyHaveOneKeyHasZero.json] gTShouldOnlyHaveOneKeyHasZero", checkQuery);
		it("[invalid/invalidFilterKeySecond.json] invalidFilterKeySecond", checkQuery);
		it("[invalid/invalidFilterKeySectionsavg.json] invalidFilterKeySectionsavg", checkQuery);
		it("[invalid/invalidKeyInEQ.json] invalidKeyInEQ", checkQuery);
		it("[invalid/invalidKeyInIS.json] invalidKeyInIS", checkQuery);
		it("[invalid/invalidKeyNullInCOLUMNS.json] invalidKeyNullInCOLUMNS", checkQuery);
		it("[invalid/invalidKeySectionsdeptInCOLUMNS.json] invalidKeySectionsdeptInCOLUMNS", checkQuery);
		it("[invalid/invalidKeysInOPTIONS.json] invalidKeysInOPTIONS", checkQuery);
		it("[invalid/invalidORDERType.json] invalidORDERType", checkQuery);
		it("[invalid/invalidORDERTypeBrackets.json] invalidORDERTypeBrackets", checkQuery);
		it("[invalid/invalidORDERTypesquare.json] invalidORDERTypesquare", checkQuery);
		it("[invalid/invalidTypeOfCOLUMNKey.json] invalidTypeOfCOLUMNKey", checkQuery);
		it("[invalid/invalidTypeOfCOLUMNKeyFieldKey.json] invalidTypeOfCOLUMNKeyFieldKey", checkQuery);
		it("[invalid/invalidTypeOfCOLUMNKeySecond.json] invalidTypeOfCOLUMNKeySecond", checkQuery);
		it("[invalid/invalidValueTypeInGTShouldBeNumber.json] invalidValueTypeInGTShouldBeNumber", checkQuery);
		it("[invalid/invalidValueTypeInISShouldBeString.json] invalidValueTypeInISShouldBeString", checkQuery);
		it("[invalid/iSShouldOnlyHaveOneKeyHasTwo.json] iSShouldOnlyHaveOneKeyHasTwo", checkQuery);
		it("[invalid/iSShouldOnlyHaveOneKeyHasZero.json] iSShouldOnlyHaveOneKeyHasZero", checkQuery);
		it("[invalid/notCorrectObject.json] notCorrectObject", checkQuery);
		it("[invalid/nOTMustBeObject.json] nOTMustBeObject", checkQuery);
		it("[invalid/nOTMustBeObjectSquareBrackets.json] nOTMustBeObjectSquareBrackets", checkQuery);
		it("[invalid/nOTShouldOnlyHaveOneKeyHasTwo.json] nOTShouldOnlyHaveOneKeyHasTwo", checkQuery);
		it("[invalid/nOTShouldOnlyHaveOneKeyHasZero.json] nOTShouldOnlyHaveOneKeyHasZero", checkQuery);
		it("[invalid/nullQuery.json] nullQuery", checkQuery);
		it("[invalid/onlyThreeAsterisk.json] onlyThreeAsterisk", checkQuery);
		it("[invalid/oPTIONSMissingCOLUMNS.json] oPTIONSMissingCOLUMNS", checkQuery);
		it("[invalid/oRDERANDCOLUMNSKEYSWAPPED.json] oRDERANDCOLUMNSKEYSWAPPED", checkQuery);
		it("[invalid/oRDERCannotBeNull.json] oRDERCannotBeNull", checkQuery);
		it("[invalid/oRMustBeANonEmptyArray.json] oRMustBeANonEmptyArray", checkQuery);
		it("[invalid/oRMustBeANonEmptyArrayBrackets.json] oRMustBeANonEmptyArrayBrackets", checkQuery);
		it("[invalid/oRMustBeANonEmptyArrayEmptyString.json] oRMustBeANonEmptyArrayEmptyString", checkQuery);
		it("[invalid/oRMustBeANonEmptyArrayEmptyStringSecond.json] oRMustBeANonEmptyArrayEmptyStringSecond", checkQuery);
		it("[invalid/oRMustBeANonEmptyArraySecond.json] oRMustBeANonEmptyArraySecond", checkQuery);
		it("[invalid/oRShouldOnlyHaveOneKeyHasTwo.json] oRShouldOnlyHaveOneKeyHasTwo", checkQuery);
		it("[invalid/oRShouldOnlyHaveOneKeyHasZero.json] oRShouldOnlyHaveOneKeyHasZero", checkQuery);
		it("[invalid/referencedDatasetCannotBeEmptyString.json] referencedDatasetCannotBeEmptyString", checkQuery);
		it("[invalid/referencedDatasetSectionNotAddedYet.json] referencedDatasetSectionNotAddedYet", checkQuery);
		it("[invalid/wHEREMustBeObject.json] wHEREMustBeObject", checkQuery);
		it("[invalid/wHEREMustBeObjectNotNull.json] wHEREMustBeObjectNotNull", checkQuery);
		it("[invalid/wHEREMustBeObjectNotSquare.json] wHEREMustBeObjectNotSquare", checkQuery);
		it("[invalid/wHEREShouldOnlyHaveOneKeyHasTwo.json] wHEREShouldOnlyHaveOneKeyHasTwo", checkQuery);
		it("[invalid/notNothingIsEverything.json] notNothingIsEverything", checkQuery);
		it("[invalid/oPTIONSMustBeObject.json] oPTIONSMustBeObject", checkQuery);
		it("[invalid/gTMustBeObject.json] gTMustBeObject", checkQuery);
		it("[invalid/iSMustBeObject.json] iSMustBeObject", checkQuery);
		it("[invalid/invalidFilterFieldKeyTypeGTNoDuplicate.json] invalidFilterFieldKeyTypeGTNoDuplicate", checkQuery);
		it("[invalid/invalidFilterFieldKeyTypeISNoDuplicate.json] invalidFilterFieldKeyTypeISNoDuplicate", checkQuery);
		it("[invalid/invalidKeyColumnsFieldName.json] invalidKeyColumnsFieldName", checkQuery);
		it("[invalid/twoMiddleAsterisk.json] twoMiddleAsterisk", checkQuery);
		it("[invalid/columnsEmptyWhereValidEmpty.json] columnsEmptyWhereValidEmpty", checkQuery);
		it("[invalid/missingOptionsWhereValidEmpty.json] missingOptionsWhereValidEmpty", checkQuery);
		it("[invalid/oPTIONSMissingCOLUMNSWhereValidEmpty.json] oPTIONSMissingCOLUMNSWhereValidEmpty", checkQuery);
		it("[invalid/wHEREMustBeObjectNotSquareEmptyOptions.json] wHEREMustBeObjectNotSquareEmptyOptions", checkQuery);
		it(
			"[invalid/cOLUMNSMustBeANonEmptyArrayNotEmptyString.json] cOLUMNSMustBeANonEmptyArrayNotEmptyString",
			checkQuery
		);
		//it("[invalid/cannotTakeaExactlyFiveThousandsAndOne.json] cannotTakeaExactlyFiveThousandsAndOne", checkQuery); //
	});
});