Skip to content

Commit

Permalink
spec: Add test to validate that kits can be downloaded
Browse files Browse the repository at this point in the history
Signed-off-by: Kostiantyn Kostiuk <[email protected]>
  • Loading branch information
kostyanf14 committed Dec 5, 2024
1 parent 36eb3da commit f9fc206
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions spec/kit_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require_relative '../lib/all'

describe 'kit_spec' do
Dir['./lib/engines/hckinstall/kits/*.json'].each do |json_file|
kit_url = AutoHCK::Models::Kit.from_json_file(json_file).download_url
next if kit_url.nil?

it "Kit for #{json_file} can be downloaded" do
content = String.new

HTTPClient.get_content(kit_url) do |chunk|
content << chunk
break if content.size > 32_773
end

file_type = nil
file_type = 'exe' if content[0..1] == 'MZ'
file_type = 'iso' if content[32_769..32_773] == 'CD001'

expect(%w[exe iso]).to include(file_type)
end
end
end

0 comments on commit f9fc206

Please sign in to comment.