is-domain-alive.test.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. import { describe, it } from 'mocha';
  2. import { isDomainAlive, noWhois } from './is-domain-alive';
  3. import { expect } from 'expect';
  4. import process from 'node:process';
  5. describe('whoisExists', () => {
  6. it('.cryptocrawler.io', () => {
  7. expect(noWhois({
  8. 'whois.nic.io': {
  9. 'Domain Status': [],
  10. 'Name Server': [],
  11. '>>> Last update of WHOIS database': '2025-01-05T11:06:38Z <<<',
  12. text: [
  13. 'Domain not found.',
  14. '',
  15. 'Terms of Use: Access to WHOIS'
  16. ]
  17. }
  18. })).toBe('Domain not found.');
  19. });
  20. it('.tunevideo.ru', () => {
  21. expect(noWhois({
  22. 'whois.tcinet.ru': {
  23. 'Domain Status': [],
  24. 'Name Server': [],
  25. text: [
  26. '% TCI Whois Service. Terms of use:',
  27. '% https://tcinet.ru/documents/whois_ru_rf.pdf (in Russian)',
  28. '% https://tcinet.ru/documents/whois_su.pdf (in Russian)',
  29. '',
  30. 'No entries found for the selected source(s).',
  31. '',
  32. 'Last updated on 2025-01-05T11:03:01Z'
  33. ]
  34. }
  35. })).toBe('No entries found for the selected source(s).');
  36. });
  37. it('nosuchpool.cl', () => {
  38. expect(noWhois({
  39. 'whois.nic.cl': {
  40. 'Domain Status': [],
  41. 'Name Server': [],
  42. 'nosuchpool.cl': 'no entries found.',
  43. text: [
  44. '%%',
  45. '%% This is the NIC Chile Whois server (whois.nic.cl).',
  46. '%%',
  47. '%% Rights restricted by copyright.',
  48. '%% See https://www.nic.cl/normativa/politica-publicacion-de-datos-cl.pdf',
  49. '%%'
  50. ]
  51. }
  52. })).toBe('nosuchpool.cl: no entries found.');
  53. });
  54. it('whois.domain-registry.nl', () => {
  55. expect(noWhois({
  56. 'whois.domain-registry.nl': {
  57. 'Domain Status': [],
  58. 'Name Server': [],
  59. text: [
  60. 'spookyplanet.nl is free'
  61. ]
  62. }
  63. })).toBe('spookyplanet.nl is free');
  64. });
  65. });
  66. describe('isDomainAlive', function () {
  67. this.timeout(10000);
  68. // it('.cryptocrawler.io', async () => {
  69. // expect((await isDomainAlive('.cryptocrawler.io', true))[1]).toEqual(false);
  70. // });
  71. // it('.tunevideo.ru', async () => {
  72. // expect((await isDomainAlive('.tunevideo.ru', true))[1]).toEqual(false);
  73. // });
  74. // it('.myqloud.com', async () => {
  75. // expect((await isDomainAlive('.myqloud.com', true))[1]).toEqual(true);
  76. // });
  77. // it('discount-deal.org', async () => {
  78. // expect((await isDomainAlive('discount-deal.org', false))[1]).toEqual(false);
  79. // });
  80. // it('ithome.com.tw', async () => {
  81. // expect((await isDomainAlive('ithome.com.tw', false))[1]).toEqual(true);
  82. // });
  83. // it('flipkart.com', async () => {
  84. // expect((await isDomainAlive('flipkart.com', false))[1]).toEqual(true);
  85. // });
  86. // it('lzzyimg.com', async () => {
  87. // expect((await isDomainAlive('.lzzyimg.com', true))[1]).toEqual(true);
  88. // });
  89. // it('tayfundogdas.me', async () => {
  90. // expect((await isDomainAlive('.tayfundogdas.me', true))[1]).toEqual(true);
  91. // });
  92. it('spookyplanet.nl', async () => {
  93. process.env.DEBUG = 'true';
  94. expect((await isDomainAlive('.spookyplanet.nl', true))[1]).toEqual(false);
  95. });
  96. });