Skip to content

Commit

Permalink
Add packager tests (#120)
Browse files Browse the repository at this point in the history
* Remove unused code

* Test vendored_pin_for
  • Loading branch information
AndyStabler authored Apr 30, 2022
1 parent 4478efd commit 4d02a20
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/packager_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ def code() "200" end
end

test "failed request with mock" do
response = Class.new do
def code() "500" end
end.new

Net::HTTP.stub(:post, proc { raise "Unexpected Error" }) do
assert_raises(Importmap::Packager::HTTPError) do
@packager.import("[email protected]")
Expand All @@ -54,4 +50,9 @@ def code() "500" end
test "pin_for" do
assert_equal %(pin "react", to: "https://cdn/react"), @packager.pin_for("react", "https://cdn/react")
end

test "vendored_pin_for" do
assert_equal %(pin "react" # @17.0.2), @packager.vendored_pin_for("react", "https://cdn/[email protected]")
assert_equal %(pin "javascript/react", to: "javascript--react.js" # @17.0.2), @packager.vendored_pin_for("javascript/react", "https://cdn/[email protected]")
end
end

0 comments on commit 4d02a20

Please sign in to comment.