<commit_before>import test from 'ava';
import { HTTPSScheme } from '../src/https-scheme';
import { Context } from '../src/context';
import { URL } from 'url';

test('https has name', t => {
  const scheme = new HTTPSScheme();
  t.is(scheme.name, 'https');
});

test('https is secure', t => {
  const scheme = new HTTPSScheme();
  t.is(scheme.isSecure, true);
});

test('https default port', t => {
  const scheme = new HTTPSScheme();
  t.is(scheme.defaultPort, 443);
});

test.cb('https can get', t => {
  const context = new Context();
  const scheme = new HTTPSScheme();

  t.plan(1);

  scheme.get(context, new URL('https://www.heise.de/index.html')).then(stream =>
    stream.on('data', chunk => {
      if (chunk.includes('DOCTYPE')) {
        t.pass();
        t.end();
      }
    })
  );
});

test('https can stat', async t => {
  const context = new Context();
  const scheme = new HTTPSScheme();
  const response = await scheme.stat(
    context,
    new URL('https://www.heise.de/index.html')
  );<commit_msg>test: http 2 with https://http2.pro/doc/api<commit_after>import test from 'ava';
import { HTTPSScheme } from '../src/https-scheme';
import { Context } from '../src/context';
import { URL } from 'url';

test('https has name', t => {
  const scheme = new HTTPSScheme();
  t.is(scheme.name, 'https');
});

test('https is secure', t => {
  const scheme = new HTTPSScheme();
  t.is(scheme.isSecure, true);
});

test('https default port', t => {
  const scheme = new HTTPSScheme();
  t.is(scheme.defaultPort, 443);
});

test.cb('https can get', t => {
  const context = new Context();
  const scheme = new HTTPSScheme();

  t.plan(1);

  scheme.get(context, new URL('https://www.heise.de/index.html')).then(stream =>
    stream.on('data', chunk => {
      if (chunk.includes('DOCTYPE')) {
        t.pass();
        t.end();
      }
    })
  );
});

test('https (http 2.0) can stat', async t => {
  const context = new Context();
  const scheme = new HTTPSScheme();
  const response = await scheme.stat(
    context,
    new URL('https://http2.pro/doc/api')
  );
  t.is(response.status, 200);
});

test('https can stat', async t => {
  const context = new Context();
  const scheme = new HTTPSScheme();
  const response = await scheme.stat(
    context,
    new URL('https://www.heise.de/index.html')
  );
{'fraction_non_alphanumeric': 0.1898188093183779, 'fraction_numerical': 0.006902502157031924, 'mean_word_length': 3.2240437158469946, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 6, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5653187', 'n_tokens_mistral': 800, 'n_tokens_neox': 769, 'n_words': 204}