From cfcb2033a871cdaad13f9dbdf997226789f64fe8 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Thu, 8 Jun 2023 19:11:40 -0400 Subject: [PATCH] tests: Ensure latest joshuto commit --- tests/main.cr | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/main.cr b/tests/main.cr index 5cfbe61a..d65227ed 100644 --- a/tests/main.cr +++ b/tests/main.cr @@ -1,5 +1,7 @@ require "spec" require "colorize" +require "http/client" +require "json" describe "nix-config" do it "includes all modules" do @@ -13,4 +15,17 @@ describe "nix-config" do puts "✓".colorize(:green) 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