You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Engine_Rebuild/tests/fileutils-test.ts

47 lines
1.3 KiB
TypeScript

import {DocumentDirectory, FileNode} from "../src/ts_source/fileutils";
const path = require('path');
const chai = require('chai');
describe('fileutils', () => {
it('DocumentDirectory Constructor fail-on-not-exist', testDocumentDirectoryFailNoExist)
it('DocumentDirectory Constructor fail-on-file', testDocumentDirectoryFailFile)
it('documentDirectoryConstructor - debug', testDocumentDirectoryConstructor);
it('pass by test', passBy);
});
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 documents = new DocumentDirectory(directoryPath);
documents.getCards()
}
function passBy(){
let a = ["a", "b"];
let b = ["c", "d"];
testCopy(a, b);
for(let c in a){
console.log(c);
}
}
function testCopy(a: String[], b: String[]){
a.push(...b);
}