More tests for type conversion

This commit is contained in:
jeremy@jermolene.com 2022-09-01 11:31:56 +01:00
parent 4a23bc5c40
commit dceb873ce1
1 changed files with 6 additions and 0 deletions

View File

@ -25,6 +25,10 @@ describe("json filter tests", function() {
title: "Second",
text: '["une","deux","trois"]',
type: "application/json"
},{
title: "Third",
text: "This is not JSON",
type: "text/vnd.tiddlywiki"
}];
wiki.addTiddlers(tiddlers);
@ -33,6 +37,7 @@ describe("json filter tests", function() {
});
it("should support the jsonget operator", function() {
expect(wiki.filterTiddlers("[{Third}jsonget[]]")).toEqual(["This is not JSON"]);
expect(wiki.filterTiddlers("[{First}jsonget[]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']);
expect(wiki.filterTiddlers("[{First}jsonget[a]]")).toEqual(["one"]);
expect(wiki.filterTiddlers("[{First}jsonget[b]]")).toEqual([""]);
@ -64,6 +69,7 @@ describe("json filter tests", function() {
});
it("should support the jsontype operator", function() {
expect(wiki.filterTiddlers("[{Third}jsontype[]]")).toEqual(["string"]);
expect(wiki.filterTiddlers("[{First}jsontype[]]")).toEqual(["object"]);
expect(wiki.filterTiddlers("[{First}jsontype[a]]")).toEqual(["string"]);
expect(wiki.filterTiddlers("[{First}jsontype[b]]")).toEqual(["string"]);