Skip to content

Commit e5c3100

Browse files
committed
Make SourcePathHandlers pass settings.
Fixes #63
1 parent c8e8362 commit e5c3100

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/handlers/SourcePathHandler.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ export default class SourcePathHandler {
66
this._paths = pathFactory;
77
}
88

9-
handle() {
9+
handle({ settings }) {
1010
return source => new PathFactory({
1111
handlers: { ...defaultHandlers },
1212
resolvers: [new SubjectPathResolver(this._paths, source)],
13-
}).create();
13+
}).create(settings, {});
1414
}
1515
}

test/handlers/SourcePathHandler-test.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ const path = {};
99
PathFactory.prototype.create.mockReturnValue(path);
1010

1111
describe('a SourcePathHandler', () => {
12-
const factory = {}, source = {};
12+
const factory = {}, source = {}, settings = { x: 1 };
1313
let handler, subjectResolverFn;
1414

1515
beforeEach(() => {
1616
handler = new SourcePathHandler(factory);
17-
subjectResolverFn = handler.handle();
17+
subjectResolverFn = handler.handle({ settings });
1818
});
1919

2020
it('returns a function', () => {
@@ -33,6 +33,7 @@ describe('a SourcePathHandler', () => {
3333
expect(resolvers).toHaveLength(1);
3434
expect(resolvers[0]).toBeInstanceOf(SubjectPathResolver);
3535
expect(PathFactory.mock.instances[0].create).toHaveBeenCalledTimes(1);
36+
expect(PathFactory.mock.instances[0].create).toHaveBeenCalledWith(settings, {});
3637
expect(result).toBe(path);
3738
});
3839

0 commit comments

Comments
 (0)