-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: simplify Dataset implementations
- Loading branch information
Showing
5 changed files
with
127 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@zazuko/env": patch | ||
--- | ||
|
||
`DatasetExt#filter` was annotated with wrong return type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { expect } from 'chai' | ||
import { Dataset } from '../../lib/Dataset.js' | ||
|
||
describe('Dataset', () => { | ||
describe('.filter', () => { | ||
it('returns instance of its type', () => { | ||
// given | ||
const dataset = new Dataset() | ||
|
||
// when | ||
const filtered = dataset.filter(() => true) | ||
|
||
// then | ||
expect(filtered).to.be.instanceOf(Dataset) | ||
}) | ||
}) | ||
|
||
describe('.match', () => { | ||
it('returns instance of its type', () => { | ||
// given | ||
const dataset = new Dataset() | ||
|
||
// when | ||
const matched = dataset.match() | ||
|
||
// then | ||
expect(matched).to.be.instanceOf(Dataset) | ||
}) | ||
}) | ||
|
||
describe('.merge', () => { | ||
it('returns instance of its type', () => { | ||
// given | ||
const dataset = new Dataset() | ||
|
||
// when | ||
const merged = dataset.merge([]) | ||
|
||
// then | ||
expect(merged).to.be.instanceOf(Dataset) | ||
}) | ||
}) | ||
|
||
describe('.map', () => { | ||
it('returns instance of its type', () => { | ||
// given | ||
const dataset = new Dataset() | ||
|
||
// when | ||
const mapped = dataset.map(quad => quad) | ||
|
||
// then | ||
expect(mapped).to.be.instanceOf(Dataset) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import FormatsFactory from '@rdfjs/formats/Factory.js' | ||
import { expect } from 'chai' | ||
import { createConstructor } from '../../lib/DatasetExt.js' | ||
import Environment from '../../Environment.js' | ||
|
||
describe('DatasetExt', () => { | ||
const Dataset = createConstructor(new Environment([FormatsFactory])) | ||
|
||
describe('.filter', () => { | ||
it('returns instance of its type', () => { | ||
// given | ||
const dataset = new Dataset() | ||
|
||
// when | ||
const filtered = dataset.filter(() => true) | ||
|
||
// then | ||
expect(filtered).to.be.instanceOf(Dataset) | ||
}) | ||
}) | ||
|
||
describe('.match', () => { | ||
it('returns instance of its type', () => { | ||
// given | ||
const dataset = new Dataset() | ||
|
||
// when | ||
const matched = dataset.match() | ||
|
||
// then | ||
expect(matched).to.be.instanceOf(Dataset) | ||
}) | ||
}) | ||
|
||
describe('.merge', () => { | ||
it('returns instance of its type', () => { | ||
// given | ||
const dataset = new Dataset() | ||
|
||
// when | ||
const merged = dataset.merge([]) | ||
|
||
// then | ||
expect(merged).to.be.instanceOf(Dataset) | ||
}) | ||
}) | ||
|
||
describe('.map', () => { | ||
it('returns instance of its type', () => { | ||
// given | ||
const dataset = new Dataset() | ||
|
||
// when | ||
const mapped = dataset.map(quad => quad) | ||
|
||
// then | ||
expect(mapped).to.be.instanceOf(Dataset) | ||
}) | ||
}) | ||
}) |