index.test.js 461 B

1234567891011121314
  1. import test from 'tape';
  2. import { isRemote } from '#/common';
  3. test('isRemote', (t) => {
  4. t.notOk(isRemote());
  5. t.notOk(isRemote('file:///tmp/file'));
  6. t.notOk(isRemote('data:text/plain,hello,world'));
  7. t.ok(isRemote('http://www.google.com'));
  8. t.ok(isRemote('https://www.google.com'));
  9. t.notOk(isRemote('http://localhost/a.user.js'));
  10. t.notOk(isRemote('https://localhost/a.user.js'));
  11. t.notOk(isRemote('http://127.0.0.1/a.user.js'));
  12. t.end();
  13. });