For Michela

import Server from "../src/rest/Server"; import {expect} from 'chai'; import Log from "../src/Util"; import {InsightResponse} from "../src/controller/IInsightFacade"; import InsightFacade, {CourseObject} from "../src/controller/InsightFacade"; import * as fs from "fs"; import DatasetManager, {Dataset} from "../src/controller/DatasetManager"; import Query from "../src/language/Query"; describe("DatabaseManagerSpec", function () { var query: Query; this.timeout(8000); var facade: InsightFacade = null; var datasetManager: DatasetManager = null; var coursesZip : string = null; var dataset : Dataset = null; var query00 : any; before( function() { Log.trace("Query Interp Test before():: "); coursesZip = fs.readFileSync("vZipvJSON.zip", 'base64'); query00 = JSON.parse(fs.readFileSync("./queries/query00.json", 'utf8')); var path = './data/courses.json'; if (fs.existsSync(path)){ try { fs.unlinkSync(path); } catch (err) { // Log.trace("InsightFacadeSpec After:: Nothing to unlink."); } } }); beforeEach(function () { facade = new InsightFacade(); datasetManager = new DatasetManager(); query = new Query(); }); afterEach(function () { query = null; datasetManager = null; facade = null; }); it.only(":: Expect addDataset to add a dataset that doesn't exist yet", function() { return facade.addDataset("courses", coursesZip).then((response) => { expect(response.code).to.equal(204); dataset = datasetManager.getDatasetsFromDisk()[0]; console.log(dataset); }).catch((err) => { expect.fail(err); }) }); it.only(":: Query parse query00 with dataset", function () { query.parse(query00, dataset); var response = query.interpret(); console.log(response); }) });
whats up

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.