import { sslTest, dnssec, headers, dmarcSpf } from './queries';

import test from 'ava';

test('SSL positive', async t => {
    const result = await sslTest({ host: 'google.com' });
    t.is(result.endpoints.length, 2);
    t.is(result.endpoints[0].grade, 'B');
    t.is(result.endpoints[1].grade, 'B');
    t.true(result.endpoints[0].details.supportsAlpn);
    t.true(result.endpoints[1].details.supportsAlpn);
});

test('DNSSEC positive', async t => {
    const result = await dnssec({ host: 'verisigninc.com' });
    t.true(result.secure);
});

test('DNSSEC negative', async t => {
    const result = await dnssec({ host: 'google.com' });
    t.false(result.secure);
});

test('Security headers positive', async t => {
    const result = await headers({ url: 'https://securityheaders.io' });
    const sts = result.get('strict-transport-security');
    if (!sts) {
        t.fail('STS header should be set.');
    } else {
        t.true('preload' in sts);
        t.true('includeSubDomains' in sts);
        t.true(Number(sts['max-age']) >= 31536000);
    }
});

test('DMARC/SPF positive', async t => {
    t.true(await dmarcSpf({ hostname: 'valimail.com' }));
});

import { sslTest, dnssec, headers, dmarcSpf } from './queries';

import test from 'ava';

test('SSL positive', async t => {
    const result = await sslTest({ host: 'google.com' });
    t.is(result.endpoints.length, 2);
    t.is(result.endpoints[0].grade, 'A');
    t.is(result.endpoints[1].grade, 'A');
    t.true(result.endpoints[0].details.supportsAlpn);
    t.true(result.endpoints[1].details.supportsAlpn);
});

test('DNSSEC positive', async t => {
    const result = await dnssec({ host: 'verisigninc.com' });
    t.true(result.secure);
});

test('DNSSEC negative', async t => {
    const result = await dnssec({ host: 'google.com' });
    t.false(result.secure);
});

test('Security headers positive', async t => {
    const result = await headers({ url: 'https://securityheaders.io' });
    const sts = result.get('strict-transport-security');
    if (!sts) {
        t.fail('STS header should be set.');
    } else {
        t.true('preload' in sts);
        t.true('includeSubDomains' in sts);
        t.true(Number(sts['max-age']) >= 31536000);
    }
});

test('DMARC/SPF positive', async t => {
    t.true(await dmarcSpf({ hostname: 'valimail.com' }));
});

--- 
+++ 
@@ -5,8 +5,8 @@
 test('SSL positive', async t => {
     const result = await sslTest({ host: 'google.com' });
     t.is(result.endpoints.length, 2);
-    t.is(result.endpoints[0].grade, 'A');
-    t.is(result.endpoints[1].grade, 'A');
+    t.is(result.endpoints[0].grade, 'B');
+    t.is(result.endpoints[1].grade, 'B');
     t.true(result.endpoints[0].details.supportsAlpn);
     t.true(result.endpoints[1].details.supportsAlpn);
 });
Change SSLLabs grade for google.com to B

Google supports TLS 1.0 and 1.1 so the grade is capped to B.

See: https://blog.qualys.com/ssllabs/2018/11/19/grade-change-for-tls-1-0-and-tls-1-1-protocols
