mirror of https://github.com/TriliumNext/Notes
skeleton of first tests
parent
915b1d1a45
commit
99120be46d
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,47 @@
|
|||||||
|
import attributeParser from '../src/public/app/services/attribute_parser.mjs';
|
||||||
|
|
||||||
|
function describe(name, cb) {
|
||||||
|
console.log(`Running ${name}`);
|
||||||
|
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
|
||||||
|
function it(name, cb) {
|
||||||
|
console.log(` Running ${name}`);
|
||||||
|
|
||||||
|
cb();
|
||||||
|
}
|
||||||
|
|
||||||
|
let errorCount = 0;
|
||||||
|
|
||||||
|
function expect(val) {
|
||||||
|
return {
|
||||||
|
toEqual: comparedVal => {
|
||||||
|
const jsonVal = JSON.stringify(val);
|
||||||
|
const comparedJsonVal = JSON.stringify(comparedVal);
|
||||||
|
|
||||||
|
if (jsonVal !== comparedJsonVal) {
|
||||||
|
console.trace("toEqual check failed.");
|
||||||
|
console.error(`expected: ${comparedJsonVal}`);
|
||||||
|
console.error(`got: ${jsonVal}`);
|
||||||
|
|
||||||
|
errorCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
describe("Lexer fulltext", () => {
|
||||||
|
it("simple label", () => {
|
||||||
|
expect(attributeParser.lexer("#label")).toEqual(["#labe"]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log("");
|
||||||
|
|
||||||
|
if (errorCount) {
|
||||||
|
console.log(`!!!${errorCount} tests failed!!!`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log("All tests passed!");
|
||||||
|
}
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import attributeParser from '../../src/public/app/services/search/attribute_parser.js';
|
|
||||||
|
|
||||||
describe("Lexer fulltext", () => {
|
|
||||||
it("simple lexing", () => {
|
|
||||||
console.log("HI!");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Loading…
Reference in New Issue