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

feat(core): remove ability to provide configs via FeatureServiceRegistry #500

Merged
merged 2 commits into from
Jun 5, 2019
Merged
Show file tree
Hide file tree
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
8 changes: 2 additions & 6 deletions packages/async-ssr-manager/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async function simulateAsyncOperation(result: number): Promise<number> {
}

describe('defineAsyncSsrManager', () => {
let mockEnv: FeatureServiceEnvironment<undefined, {}>;
let mockEnv: FeatureServiceEnvironment<{}>;

let asyncSsrManagerDefinition: FeatureServiceProviderDefinition<
SharedAsyncSsrManager
Expand All @@ -34,10 +34,7 @@ describe('defineAsyncSsrManager', () => {
});

beforeEach(() => {
mockEnv = {
config: undefined,
featureServices: {'s2:logger': stubbedLogger}
};
mockEnv = {featureServices: {'s2:logger': stubbedLogger}};
});

it('creates an Async SSR Manager definition', () => {
Expand Down Expand Up @@ -322,7 +319,6 @@ describe('defineAsyncSsrManager', () => {
asyncSsrManagerDefinition = defineAsyncSsrManager();

asyncSsrManagerBinder = asyncSsrManagerDefinition.create({
config: undefined,
featureServices: {}
})['1.0.0'];
});
Expand Down
20 changes: 1 addition & 19 deletions packages/core/src/__tests__/create-feature-hub.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,24 +195,6 @@ describe('createFeatureHub()', () => {
});
});

describe('and with Feature Service configs', () => {
beforeEach(() => {
featureHubOptions = {
...featureHubOptions,
featureServiceConfigs: {'test:feature-service': 'mockConfig'}
};
});

it('registers and creates the Feature Services, using the relevant config', () => {
createFeatureHub('test:integrator', featureHubOptions);

expect(mockFeatureServiceCreate).toHaveBeenCalledWith({
config: 'mockConfig',
featureServices: {}
});
});
});

describe('and with provided externals', () => {
beforeEach(() => {
featureHubOptions = {...featureHubOptions, providedExternals: {}};
Expand Down Expand Up @@ -284,7 +266,7 @@ describe('createFeatureHub()', () => {

expectedLogCalls = [
[
'The Feature Service "test:feature-service" has been successfully registered by consumer "test:integrator".'
'The Feature Service "test:feature-service" has been successfully registered by registrant "test:integrator".'
],
['The Feature App "test:feature-app" has been successfully created.']
];
Expand Down
25 changes: 13 additions & 12 deletions packages/core/src/__tests__/feature-app-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe('FeatureAppManager', () => {
});

expect(mockFeatureServiceRegistry.bindFeatureServices.mock.calls).toEqual(
[[mockFeatureAppDefinition, idSpecifier]]
[[mockFeatureAppDefinition, 'testId:testIdSpecifier']]
);

const {featureServices} = mockFeatureServicesBinding;
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('FeatureAppManager', () => {
const {featureServices} = mockFeatureServicesBinding;

expect(mockBeforeCreate.mock.calls).toEqual([
['testId', featureServices]
[mockFeatureAppDefinition.id, featureServices]
]);
});

Expand All @@ -226,7 +226,7 @@ describe('FeatureAppManager', () => {
const {featureServices} = mockFeatureServicesBinding;

expect(mockBeforeCreate.mock.calls).toEqual([
['testId', featureServices]
[mockFeatureAppDefinition.id, featureServices]
]);
});
});
Expand All @@ -250,7 +250,7 @@ describe('FeatureAppManager', () => {
const {featureServices} = mockFeatureServicesBinding;

expect(mockBeforeCreate.mock.calls).toEqual([
[`testId:${idSpecifier}`, featureServices]
[`${mockFeatureAppDefinition.id}:${idSpecifier}`, featureServices]
]);
});
});
Expand Down Expand Up @@ -411,19 +411,20 @@ describe('FeatureAppManager', () => {
});

it("registers the Feature App's own Feature Services before binding its required Feature Services", () => {
featureAppManager.getFeatureAppScope(mockFeatureAppDefinition, {
idSpecifier: 'testIdSpecifier'
});
featureAppManager.getFeatureAppScope(mockFeatureAppDefinition);

expect(
mockFeatureServiceRegistry.registerFeatureServices.mock.calls
).toEqual([
[mockFeatureAppDefinition.ownFeatureServiceDefinitions, 'testId']
[
mockFeatureAppDefinition.ownFeatureServiceDefinitions,
mockFeatureAppDefinition.id
]
]);

expect(
mockFeatureServiceRegistry.bindFeatureServices.mock.calls
).toEqual([[mockFeatureAppDefinition, 'testIdSpecifier']]);
).toEqual([[mockFeatureAppDefinition, mockFeatureAppDefinition.id]]);

expect(featureServiceRegistryMethodCalls).toEqual([
'registerFeatureServices',
Expand Down Expand Up @@ -453,7 +454,7 @@ describe('FeatureAppManager', () => {
const {featureServices} = mockFeatureServicesBinding;

expect(mockBeforeCreate.mock.calls).toEqual([
['testId', featureServices]
[mockFeatureAppDefinition.id, featureServices]
]);
});

Expand All @@ -480,8 +481,8 @@ describe('FeatureAppManager', () => {
const {featureServices} = mockFeatureServicesBinding;

expect(mockBeforeCreate.mock.calls).toEqual([
['testId', featureServices],
['testId', featureServices]
[mockFeatureAppDefinition.id, featureServices],
[mockFeatureAppDefinition.id, featureServices]
]);
});
});
Expand Down
Loading