Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Achieve better test coverage for Triples and Transform functions #73

Merged
merged 4 commits into from Jan 16, 2020
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Document reasoning behind seldom-reached line and

add a test for it.
  • Loading branch information
Eyas committed Jan 16, 2020
commit df8c97e199bc235cba76a008ab15b5cde8a24a97
@@ -137,6 +137,12 @@ export function* process(triples: string[][]): Iterable<Triple> {
// certain layer overlays.
continue;
}

// Schema.org 3.4 all-layers used to contain a test comment:
// (Subject: <http://meta.schema.org/>
// Predicate: <http://www.w3.org/2000/01/rdf-schema#comment>
// Object: "A test comment.")
// We skip it manually.
if (match[0] === 'http://meta.schema.org/') {
continue;
}
@@ -18,7 +18,6 @@ import {expect, use} from 'chai';
import chaiAsPromised from 'chai-as-promised';
import {ClientRequest, IncomingMessage} from 'http';
import https from 'https';
import {Observable} from 'rxjs';
import {toArray} from 'rxjs/operators';
import {SinonStub, stub} from 'sinon';
import {PassThrough, Writable} from 'stream';
@@ -140,6 +139,30 @@ describe('load', () => {
]);
});

it('Multiple (skip test comment)', async () => {
const control = fakeResponse(200, 'Ok');
control.data(
`<https://schema.org/Person> <https://schema.org/knowsAbout> "math" .\n`);
control.data(
`<http://meta.schema.org/> <http://www.w3.org/2000/01/rdf-schema#comment> "A test comment." .\n`);
control.data(
`<https://schema.org/Person> <https://schema.org/knowsAbout> "science" .\n`);
control.end();

await expect(triples).to.eventually.deep.equal([
{
Subject: UrlNode.Parse('https://schema.org/Person'),
Predicate: UrlNode.Parse('https://schema.org/knowsAbout'),
Object: SchemaString.Parse('"math"')!,
},
{
Subject: UrlNode.Parse('https://schema.org/Person'),
Predicate: UrlNode.Parse('https://schema.org/knowsAbout'),
Object: SchemaString.Parse('"science"')!,
}
]);
});

it('Multiple (dirty broken)', async () => {
const control = fakeResponse(200, 'Ok');
control.data(`<https://schema.org/Person> <https://sc`);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.