92 lines
2.3 KiB
Nix
92 lines
2.3 KiB
Nix
let
|
|
html = import ../nixite/html.nix;
|
|
elems = import ../nixite/elems.nix;
|
|
site = import ../nixite/site.nix;
|
|
it = import ./it.nix;
|
|
in with site; [
|
|
(it "applies a style" {
|
|
expected = {
|
|
"index.html" = html.tag "html" { } [
|
|
(html.tag "head" { } [
|
|
(elems.title { } "foobar")
|
|
(elems.Stylesheet "/style.css")
|
|
])
|
|
(elems.main { } "something")
|
|
];
|
|
blog = {
|
|
"index.html" = html.tag "html" { } [
|
|
(html.tag "head" { } [
|
|
(elems.title { } "foobar")
|
|
(elems.Stylesheet "/style.css")
|
|
])
|
|
(elems.main { } "blogy blog")
|
|
];
|
|
};
|
|
"style.css" = ''
|
|
this is a stylesheet
|
|
'';
|
|
};
|
|
actual = applyStyle ''
|
|
this is a stylesheet
|
|
'' {
|
|
"index.html" = html.tag "html" { } [
|
|
(html.tag "head" { } [ (elems.title { } "foobar") ])
|
|
(elems.main { } "something")
|
|
];
|
|
blog = {
|
|
"index.html" = html.tag "html" { } [
|
|
(html.tag "head" { } [ (elems.title { } "foobar") ])
|
|
(elems.main { } "blogy blog")
|
|
];
|
|
};
|
|
};
|
|
asJSON = true;
|
|
})
|
|
(it "extracts top level paths" {
|
|
actual = getPaths {
|
|
something = "";
|
|
src = ./src/index.md;
|
|
};
|
|
expected = { "index.md" = ./src/index.md; };
|
|
})
|
|
(it "extracts lower level paths" {
|
|
actual = getPaths {
|
|
something = "yes";
|
|
a-list = [
|
|
{ thingy = ./src/index.md; }
|
|
[ (html.tag "img" { src = ./src/favicon.png; } "") ]
|
|
];
|
|
};
|
|
expected = {
|
|
"index.md" = ./src/index.md;
|
|
"favicon.png" = ./src/favicon.png;
|
|
};
|
|
})
|
|
(it "switches paths" {
|
|
actual = switchPaths {
|
|
something = "";
|
|
a-thing = { src = ./src/index.md; };
|
|
a-list = [{ thingy = ./src/index.md; }];
|
|
};
|
|
expected = {
|
|
something = "";
|
|
a-thing = { src = "/static/index.md"; };
|
|
a-list = [{ thingy = "/static/index.md"; }];
|
|
};
|
|
})
|
|
|
|
(it "extracts paths" {
|
|
actual = extractPaths {
|
|
something = "";
|
|
a-thing = { src = ./src/index.md; };
|
|
a-list = [{ thingy = ./src/index.md; }];
|
|
};
|
|
expected = {
|
|
something = "";
|
|
a-thing = { src = "/static/index.md"; };
|
|
a-list = [{ thingy = "/static/index.md"; }];
|
|
static = { "index.md" = ./src/index.md; };
|
|
};
|
|
})
|
|
]
|