is-domain-alive.test.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import { describe, it } from 'mocha';
  2. import { isDomainAlive, whoisExists } from './is-domain-alive';
  3. import { expect } from 'expect';
  4. describe('whoisExists', () => {
  5. it('.cryptocrawler.io', () => {
  6. expect(whoisExists({
  7. 'whois.nic.io': {
  8. 'Domain Status': [],
  9. 'Name Server': [],
  10. '>>> Last update of WHOIS database': '2025-01-05T11:06:38Z <<<',
  11. text: [
  12. 'Domain not found.',
  13. '',
  14. 'Terms of Use: Access to WHOIS'
  15. ]
  16. }
  17. })).toBe(false);
  18. });
  19. it('.tunevideo.ru', () => {
  20. expect(whoisExists({
  21. 'whois.tcinet.ru': {
  22. 'Domain Status': [],
  23. 'Name Server': [],
  24. text: [
  25. '% TCI Whois Service. Terms of use:',
  26. '% https://tcinet.ru/documents/whois_ru_rf.pdf (in Russian)',
  27. '% https://tcinet.ru/documents/whois_su.pdf (in Russian)',
  28. '',
  29. 'No entries found for the selected source(s).',
  30. '',
  31. 'Last updated on 2025-01-05T11:03:01Z'
  32. ]
  33. }
  34. })).toBe(false);
  35. });
  36. it('.myqloud.com', () => {
  37. expect(whoisExists({
  38. 'whois.tcinet.ru': {
  39. 'Domain Status': [],
  40. 'Name Server': [],
  41. text: [
  42. '% TCI Whois Service. Terms of use:',
  43. '% https://tcinet.ru/documents/whois_ru_rf.pdf (in Russian)',
  44. '% https://tcinet.ru/documents/whois_su.pdf (in Russian)',
  45. '',
  46. 'No entries found for the selected source(s).',
  47. '',
  48. 'Last updated on 2025-01-05T11:03:01Z'
  49. ]
  50. }
  51. })).toBe(false);
  52. });
  53. });
  54. describe('isDomainAlive', function () {
  55. this.timeout(10000);
  56. it('.cryptocrawler.io', async () => {
  57. expect((await isDomainAlive('.cryptocrawler.io', true))[1]).toEqual(false);
  58. });
  59. it('.tunevideo.ru', async () => {
  60. expect((await isDomainAlive('.tunevideo.ru', true))[1]).toEqual(false);
  61. });
  62. it('.myqloud.com', async () => {
  63. expect((await isDomainAlive('.myqloud.com', true))[1]).toEqual(true);
  64. });
  65. it('discount-deal.org', async () => {
  66. expect((await isDomainAlive('discount-deal.org', false))[1]).toEqual(false);
  67. });
  68. });