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

test: Fix test #100

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions test/iterator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {fileURLToPath} from 'url';
import removeDirectory from '../src/utils/removeDir.js';
import {NamedNode} from '@rdfjs/types';
import getSPARQLQuery from '../src/utils/getSPARQLQuery.js';
import getEndpoint from '../src/utils/getEndpoint.js';
chai.use(chaiAsPromised);

describe('Iterator Class', () => {
Expand Down Expand Up @@ -57,8 +58,10 @@ describe('Iterator Class', () => {
};
const pipeline = new Pipeline(configuration, {silent: true});
const stageConfig = configuration.stages[0];
const stage = new Stage(pipeline, stageConfig);
const iterator = new Iterator(stage);
const iterator = new Iterator(
Query.from(getSPARQLQuery(stageConfig.iterator.query, 'select')),
getEndpoint(new Stage(pipeline, stageConfig))
);
chai.expect(iterator).to.be.an.instanceOf(Iterator);
chai.expect(iterator).to.be.an.instanceOf(EventEmitter);
chai.expect(iterator).to.have.property('query');
Expand All @@ -68,7 +71,7 @@ describe('Iterator Class', () => {
chai.expect(iterator).to.have.property('totalResults', 0);
});
});
describe.skip('run', () => {
describe('run', () => {
it('should emit "data" and "end" events with the correct $this and numResults', async () => {
const configuration: Configuration = {
name: 'Example Pipeline',
Expand Down Expand Up @@ -104,8 +107,10 @@ describe('Iterator Class', () => {
};
const pipeline = new Pipeline(configuration, {silent: true});
const stageConfig = configuration.stages[0];
const stage = new Stage(pipeline, stageConfig);
const iterator = new Iterator(stage);
const iterator = new Iterator(
Query.from(getSPARQLQuery(stageConfig.iterator.query, 'select')),
getEndpoint(new Stage(pipeline, stageConfig))
);
const emittedEvents: {event: string; bindings?: NamedNode}[] = [];
async function runIteratorWithPromise(): Promise<boolean> {
return new Promise((resolve, reject) => {
Expand Down