tests: Ensure latest joshuto commit

This commit is contained in:
Donovan Glover 2023-06-08 19:11:40 -04:00
parent 07ec31364f
commit cfcb2033a8
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -1,5 +1,7 @@
require "spec" require "spec"
require "colorize" require "colorize"
require "http/client"
require "json"
describe "nix-config" do describe "nix-config" do
it "includes all modules" do it "includes all modules" do
@ -13,4 +15,17 @@ describe "nix-config" do
puts "".colorize(:green) puts "".colorize(:green)
end end
end end
it "uses the latest joshuto commit" do
response = HTTP::Client.get "https://api.github.com/repos/kamiyaa/joshuto/branches/main"
response.status_code.should eq(200)
json = JSON.parse(response.body)
File.read_lines("./overlays/joshuto/default.nix").each do |line|
if line.includes? "version ="
nix_hash = line.split('"')[1]
json["commit"]["sha"].should eq(nix_hash)
end
end
end
end end