Skip to content

Commit

Permalink
fix(core): clarify error message (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
fahrradflucht authored and clebert committed Jan 2, 2019
1 parent 95e1a2d commit e77b70b
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
33 changes: 23 additions & 10 deletions packages/core/src/__tests__/feature-app-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,6 @@ describe('FeatureAppManager', () => {
});

describe('#getFeatureAppScope', () => {
it('logs an info message after creation', () => {
manager.getFeatureAppScope(mockFeatureAppDefinition, 'testIdSpecifier');

expect(spyConsoleInfo.mock.calls).toEqual([
[
'The feature app scope for the ID "testId" and its specifier "testIdSpecifier" has been successfully created.'
]
]);
});

it('creates a feature app with a consumer environment using the service registry', () => {
const mockConfig = {kind: 'test'};
const idSpecifier = 'testIdSpecifier';
Expand Down Expand Up @@ -217,6 +207,16 @@ describe('FeatureAppManager', () => {

describe('for a known feature app definition', () => {
describe('and no id specifier', () => {
it('logs an info message after creation', () => {
manager.getFeatureAppScope(mockFeatureAppDefinition);

expect(spyConsoleInfo.mock.calls).toEqual([
[
'The feature app scope for the ID "testId" has been successfully created.'
]
]);
});

it('returns the same feature app scope', () => {
const featureAppScope = manager.getFeatureAppScope(
mockFeatureAppDefinition
Expand All @@ -243,6 +243,19 @@ describe('FeatureAppManager', () => {
});

describe('and an id specifier', () => {
it('logs an info message after creation', () => {
manager.getFeatureAppScope(
mockFeatureAppDefinition,
'testIdSpecifier'
);

expect(spyConsoleInfo.mock.calls).toEqual([
[
'The feature app scope for the ID "testId" with the specifier "testIdSpecifier" has been successfully created.'
]
]);
});

it('returns the same feature app scope', () => {
const featureAppScope = manager.getFeatureAppScope(
mockFeatureAppDefinition,
Expand Down
14 changes: 9 additions & 5 deletions packages/core/src/feature-app-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,15 @@ export class FeatureAppManager implements FeatureAppManagerLike {
});

console.info(
`The feature app scope for the ID ${JSON.stringify(
featureAppDefinition.id
)} and its specifier ${JSON.stringify(
idSpecifier
)} has been successfully created.`
idSpecifier
? `The feature app scope for the ID ${JSON.stringify(
featureAppDefinition.id
)} with the specifier ${JSON.stringify(
idSpecifier
)} has been successfully created.`
: `The feature app scope for the ID ${JSON.stringify(
featureAppDefinition.id
)} has been successfully created.`
);

let destroyed = false;
Expand Down

0 comments on commit e77b70b

Please sign in to comment.