MCPcopy Index your code
hub / github.com/restify/node-restify / negativeTests

Function negativeTests

test/plugins/staticFiles.test.js:268–292  ·  view source on GitHub ↗
(
        endpoint,
        filePath,
        expectedStatusCode,
        expectedStatusMsg,
        done
    )

Source from the content-addressed store, hash-verified

266 }
267 };
268 function negativeTests(
269 endpoint,
270 filePath,
271 expectedStatusCode,
272 expectedStatusMsg,
273 done
274 ) {
275 var ENDPOINT = endpoint;
276 var fileSuffixPath = filePath;
277 var requestPath = path.join(ENDPOINT, fileSuffixPath);
278 SERVER.get(
279 ENDPOINT + '/*',
280 restify.plugins.serveStaticFiles(
281 path.resolve(STATIC_FILES_PATH),
282 OPTIONS
283 )
284 );
285
286 CLIENT.get(encodeURI(requestPath), function(err, req, res, obj) {
287 assert.exists(err);
288 assert.equal(res.statusCode, expectedStatusCode);
289 assert.equal(res.statusMessage, expectedStatusMsg);
290 done();
291 });
292 }
293 it('fail to serve root directory', function(done) {
294 negativeTests('/public', '', 404, 'Not Found', done);
295 });

Callers 1

Calls 1

doneFunction · 0.85

Tested by

no test coverage detected