<commit_before>import { sslTest, dnssec, headers } from './infr';

import * as assert from 'assert';

export async function testSslPositive() {
    const result = await sslTest({ host: 'google.com' });
    assert.equal(result.endpoints.length, 2);
    assert.equal(result.endpoints[0].grade, 'A');
    assert.equal(result.endpoints[1].grade, 'A');
    assert.ok(result.endpoints[0].details.supportsAlpn);
    assert.ok(result.endpoints[1].details.supportsAlpn);
}

export async function testDnssecPositive() {
    const result = await dnssec({ host: 'verisigninc.com' });
    assert.equal(result.secure, true);
}

export async function testDnssecNegative() {
    const result = await dnssec({ host: 'google.com' });
    assert.equal(result.secure, false);
}

export async function testHeadersPositive() {
    const result = await headers({ url: 'https://securityheaders.io' });
    const sts = result.get('strict-transport-security');
    if (!sts) {
        throw new assert.AssertionError('STS header should be set.');
    } else {
        assert.ok('preload' in sts);
        assert.ok('includeSubDomains' in sts);
        assert.ok(Number(sts['max-age']) >= 31536000);
    }
}<commit_msg>Fix type error on AssertionError constructor<commit_after>import { sslTest, dnssec, headers } from './infr';

import * as assert from 'assert';

export async function testSslPositive() {
    const result = await sslTest({ host: 'google.com' });
    assert.equal(result.endpoints.length, 2);
    assert.equal(result.endpoints[0].grade, 'A');
    assert.equal(result.endpoints[1].grade, 'A');
    assert.ok(result.endpoints[0].details.supportsAlpn);
    assert.ok(result.endpoints[1].details.supportsAlpn);
}

export async function testDnssecPositive() {
    const result = await dnssec({ host: 'verisigninc.com' });
    assert.equal(result.secure, true);
}

export async function testDnssecNegative() {
    const result = await dnssec({ host: 'google.com' });
    assert.equal(result.secure, false);
}

export async function testHeadersPositive() {
    const result = await headers({ url: 'https://securityheaders.io' });
    const sts = result.get('strict-transport-security');
    if (!sts) {
        throw new assert.AssertionError({
            message: 'STS header should be set.'
        });
    } else {
        assert.ok('preload' in sts);
        assert.ok('includeSubDomains' in sts);
        assert.ok(Number(sts['max-age']) >= 31536000);
    }
}
{'fraction_non_alphanumeric': 0.14991830065359477, 'fraction_numerical': 0.010620915032679739, 'mean_word_length': 3.7553398058252427, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, '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': '1819201', 'n_tokens_mistral': 786, 'n_tokens_neox': 761, 'n_words': 175}