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 "colorize"
|
||||
require "http/client"
|
||||
require "json"
|
||||
require "./spec_helper"
|
||||
|
||||
hint = ""
|
||||
|
||||
@ -22,16 +21,13 @@ end
|
||||
|
||||
describe "./overlays/joshuto/default.nix" do
|
||||
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)
|
||||
check_latest_commit("kamiyaa/joshuto", branch: "main")
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
describe "./overlays/rofi/default.nix" do
|
||||
it "uses the latest rofi-wayland commit" do
|
||||
check_latest_commit("lbonn/rofi", branch: "wayland")
|
||||
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