zz_

test.js

thoward37@gmail.com/push-test2-1791933121043 / test.js @ d00deec4 Download
Ladder Summary
  • file This file is an AVA test suite that imports the `isUp` function from `./index.js` and verifies its behavior with three cases: confirming a reachable URL returns `true`, confirming a randomly‑generated nonexistent URL returns `false`, and asserting that calling `isUp` with an invalid URL string throws an error with the message “Invalid URL”. The file itself does not export any functions or classes.
 'use strict';
 var test = require('ava');
 var isUp = require('./');
 
 test('up', function (t) {
  t.plan(2);
 
  isUp('google.com', function (err, up) {
  t.assert(!err, err);
  t.assert(up);
  });
 });
 
 test('down', function (t) {
  t.plan(2);
 
  isUp('afsadgsdcgdcfgefcasfcascfsadf.com', function (err, up) {
  t.assert(!err, err);
  t.assert(!up);
  });
 });
 
 test('invalid domain', function (t) {
  t.plan(1);
 
  isUp('hi', function (err) {
  t.assert(err.message === 'Invalid domain', err);
  });
 });