Feature 57 (config and provisioning): modules declare config and provisions, their files rendered from templates; synced with main (issues of feature 57, 874)
This commit is contained in:
@@ -26,14 +26,20 @@ test("both are unpacked under the account's home, owned by the account", () => {
|
||||
assert.deepEqual(byId.configuration, { id: "configuration", type: "archive", path: "${machine:account-home}/.config/powerlevel10k", owner: "${machine:account}", artifact: "configuration" });
|
||||
});
|
||||
|
||||
// The zsh code is an item of the collection shell:zsh:normal, its text a template in files/ (ADR 0348, 0349).
|
||||
const shellCode = (): string => {
|
||||
const items = m.items.filter((i: { collection: string }) => i.collection.startsWith("shell:"));
|
||||
assert.equal(items.length, 1);
|
||||
assert.equal(items[0].collection, "shell:zsh:normal", "for zsh, in the normal slot");
|
||||
return readFileSync(at(items[0].template), "utf8");
|
||||
};
|
||||
|
||||
test("the zsh code in the normal slot sources the theme, then the configuration, and turns on no instant prompt", () => {
|
||||
assert.equal(m.shell.length, 1);
|
||||
const [c] = m.shell;
|
||||
assert.equal(c.for, "zsh");
|
||||
assert.equal(c.slot, "normal");
|
||||
const sourced = [...(c.code as string).matchAll(/\|\| source (\S+)/g)].map((x) => x[1]);
|
||||
assert.equal(m.shell, undefined);
|
||||
const code = shellCode();
|
||||
const sourced = [...code.matchAll(/\|\| source (\S+)/g)].map((x) => x[1]);
|
||||
assert.deepEqual(sourced, ["~/.local/share/powerlevel10k/powerlevel10k.zsh-theme", "~/.config/powerlevel10k/p10k.zsh"]);
|
||||
assert.doesNotMatch(c.code, /instant/);
|
||||
assert.doesNotMatch(code, /instant/);
|
||||
});
|
||||
|
||||
test("the README names the upstream, the version and the licence", () => {
|
||||
@@ -41,5 +47,5 @@ test("the README names the upstream, the version and the licence", () => {
|
||||
assert.match(readme, /github\.com\/romkatv\/powerlevel10k/);
|
||||
assert.match(readme, /v1\.20\.0/);
|
||||
assert.match(readme, /MIT/);
|
||||
assert.match(m.shell[0].code, /v1\.20\.0/, "the version in the shell code's comment matches");
|
||||
assert.match(shellCode(), /v1\.20\.0/, "the version in the shell code's comment matches");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user