Skip to content

Commit a0fb029

Browse files
committed
Add breaking test
See #245 for context. The TL;DR is the response sometimes returns a String instead of Hash object. This should be handled properly. The way to handle this is up for discussion. To start addressing the issue the String response will just be surfaced as `latest_version`.
1 parent ddf9be4 commit a0fb029

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/npm_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,17 @@ def code() "200" end
9494
end
9595
end
9696
end
97+
98+
test "return response is a String type" do
99+
response = "version not found".to_json
100+
101+
@npm.stub(:get_json, response) do
102+
outdated_packages = @npm.outdated_packages
103+
104+
assert_equal(1, outdated_packages.size)
105+
assert_equal('md5', outdated_packages[0].name)
106+
assert_equal('2.2.0', outdated_packages[0].current_version)
107+
assert_equal('version not found', outdated_packages[0].latest_version)
108+
end
109+
end
97110
end

0 commit comments

Comments
 (0)