mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-22 00:03:55 +01:00
tests: Add test for rofi overlay
This commit is contained in:
parent
176f59f3bd
commit
59c19f1e7c
@ -1,7 +1,6 @@
|
|||||||
require "spec"
|
require "spec"
|
||||||
require "colorize"
|
require "colorize"
|
||||||
require "http/client"
|
require "./spec_helper"
|
||||||
require "json"
|
|
||||||
|
|
||||||
hint = ""
|
hint = ""
|
||||||
|
|
||||||
@ -22,16 +21,13 @@ end
|
|||||||
|
|
||||||
describe "./overlays/joshuto/default.nix" do
|
describe "./overlays/joshuto/default.nix" do
|
||||||
it "uses the latest joshuto commit" do
|
it "uses the latest joshuto commit" do
|
||||||
response = HTTP::Client.get "https://api.github.com/repos/kamiyaa/joshuto/branches/main"
|
check_latest_commit("kamiyaa/joshuto", branch: "main")
|
||||||
response.status_code.should eq(200)
|
end
|
||||||
json = JSON.parse(response.body)
|
end
|
||||||
|
|
||||||
File.read_lines("./overlays/joshuto/default.nix").each do |line|
|
describe "./overlays/rofi/default.nix" do
|
||||||
if line.includes? "version ="
|
it "uses the latest rofi-wayland commit" do
|
||||||
nix_hash = line.split('"')[1]
|
check_latest_commit("lbonn/rofi", branch: "wayland")
|
||||||
json["commit"]["sha"].should eq(nix_hash)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
16
tests/spec_helper.cr
Normal file
16
tests/spec_helper.cr
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
require "spec"
|
||||||
|
require "http/client"
|
||||||
|
require "json"
|
||||||
|
|
||||||
|
def check_latest_commit(repository, branch = "master")
|
||||||
|
response = HTTP::Client.get "https://api.github.com/repos/#{repository}/branches/#{branch}"
|
||||||
|
response.status_code.should eq(200)
|
||||||
|
json = JSON.parse(response.body)
|
||||||
|
|
||||||
|
File.read_lines("./overlays/#{repository.split("/")[1]}/default.nix").each do |line|
|
||||||
|
if line.includes? "version ="
|
||||||
|
nix_hash = line.split('"')[1]
|
||||||
|
json["commit"]["sha"].should eq(nix_hash)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user