Skip to content

Commit 1ec41df

Browse files
committed
Fix test error, response code from example.com was 500 instead of 404.
1 parent 695f905 commit 1ec41df

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

test/RemoteAssetCacheTest.js

+7-11
Original file line numberDiff line numberDiff line change
@@ -108,17 +108,13 @@ test("Error with `cause`", async t => {
108108
let asset = new RemoteAssetCache(finalUrl);
109109

110110
try {
111-
await asset.fetch();
111+
await asset.fetch({
112+
headers: {
113+
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
114+
}
115+
});
112116
} catch(e) {
113-
t.is(e.message, `Bad response for https://example.com/207115/photos/243-0-1.jpg (404): Not Found`)
114-
115-
// Cause is an optional enhancement for Node 16.19+
116-
let [major, minor] = process.version.split(".");
117-
major = parseInt(major.startsWith("v") ? major.slice(1) : major, 10);
118-
minor = parseInt(minor, 10);
119-
120-
if(major > 16 || major === 16 && minor > 19) {
121-
t.truthy(e.cause);
122-
}
117+
t.truthy(e.message.startsWith(`Bad response for https://example.com/207115/photos/243-0-1.jpg`));
118+
t.truthy(e.cause);
123119
}
124120
});

0 commit comments

Comments
 (0)