mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-24 17:23:09 +01:00
tests: Complete migration to TypeScript/Deno
Well, that was easy.
This commit is contained in:
parent
0976968977
commit
0f9ea294c2
@ -1,27 +0,0 @@
|
||||
require "spec"
|
||||
|
||||
def check_top_level_imports(directory)
|
||||
describe "./#{directory}/default.nix" do
|
||||
it "imports all modules in ./#{directory}/", tags: "local" do
|
||||
all_modules = Dir.children(directory)
|
||||
all_modules.delete("default.nix")
|
||||
modules = File.read("./#{directory}/default.nix")
|
||||
|
||||
all_modules.each do |current_module|
|
||||
modules.includes?("./#{current_module}").should be_true
|
||||
end
|
||||
end
|
||||
|
||||
it "only imports modules that exist in ./#{directory}/", tags: "local" do
|
||||
all_modules = Dir.children(directory)
|
||||
all_modules.delete("default.nix")
|
||||
|
||||
File.each_line("./#{directory}/default.nix") do |line|
|
||||
if line.includes? "./"
|
||||
imported_file = line.lstrip(' ').lstrip("./")
|
||||
all_modules.includes?(imported_file).should be_true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -32,14 +32,15 @@ async function assertAllModulesInDirectory(directory: string) {
|
||||
const files = await getFilesInDirectory(`./${directory}`)
|
||||
const imports = await getImportsInFile(`./${directory}/default.nix`)
|
||||
|
||||
console.log(files)
|
||||
console.log(imports)
|
||||
|
||||
for (const file of files) {
|
||||
assert(imports.includes(file))
|
||||
}
|
||||
}
|
||||
|
||||
Deno.test("imports all modules in ./packages", async () => {
|
||||
await assertAllModulesInDirectory("packages")
|
||||
const dirs = ["containers", "home", "modules", "overlays", "packages", "specializations"]
|
||||
|
||||
for (const dir of dirs) {
|
||||
Deno.test(`imports all modules in ./${dir}`, async () => {
|
||||
await assertAllModulesInDirectory(dir)
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user