import {DocumentDirectory, FileNode} from "../src/ts_source/fileutils"; const path = require('path'); const chai = require('chai'); const {performance} = require('perf_hooks'); describe('fileutils', () => { it('DocumentDirectory Constructor fail-on-not-exist', testDocumentDirectoryFailNoExist) it('DocumentDirectory Constructor fail-on-file', testDocumentDirectoryFailFile) it('documentDirectoryConstructor - debug', testDocumentDirectoryConstructor); }); function testDocumentDirectoryFailNoExist() { let directoryPath = path.join(__dirname, "../src/assets/documents/madeup"); chai.expect(() => { new DocumentDirectory(directoryPath) }).to.throw(Error) } function testDocumentDirectoryFailFile() { let directoryPath = path.join(__dirname, "../src/assets/documents/Test.Word.Dock.docx"); chai.expect(() => { new DocumentDirectory(directoryPath) }).to.throw(Error) } function testDocumentDirectoryConstructor() { let directoryPath = path.join(__dirname, "../src/assets/resources"); let start = performance.now() let documents = new DocumentDirectory(directoryPath); let end = performance.now() console.log(documents.getCards()); console.log(`Execution time: ${end-start}ms`) }