Skip to content

Commit

Permalink
feat(config-service): add new options to the string update to hide th…
Browse files Browse the repository at this point in the history
…e value of just do not display it

refactor the specs objects to use the as type
  • Loading branch information
C0ZEN committed Mar 28, 2020
1 parent a773c3a commit aceee56
Show file tree
Hide file tree
Showing 7 changed files with 390 additions and 88 deletions.
19 changes: 11 additions & 8 deletions src/features/app/services/app-config-service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import moment from 'moment';
import { IConfigUpdateBoolean } from '../../config/interfaces/config-update-boolean';
import { IConfigUpdateNumber } from '../../config/interfaces/config-update-number';
import { IConfigUpdateString } from '../../config/interfaces/config-update-string';
import { ConfigService } from '../../config/services/config-service';
import { APP_CONFIG } from '../constants/app-config';
import { IAppConfig } from '../interfaces/app-config';
import { AppConfigService } from './app-config-service';
import moment = require(`moment`);

jest.mock(`../../config/services/config-service`);

Expand Down Expand Up @@ -78,7 +81,7 @@ describe(`AppConfigService`, (): void => {
newValue: `dummy-version`,
oldValue: `version`,
valueName: `version`
});
} as IConfigUpdateString);
});

it(`should update the app config version with the updated string`, (): void => {
Expand Down Expand Up @@ -203,7 +206,7 @@ describe(`AppConfigService`, (): void => {
newValue: `dummy-release-date`,
oldValue: `release-date`,
valueName: `release date`
});
} as IConfigUpdateString);
});

it(`should update the app config release date with the updated string`, (): void => {
Expand Down Expand Up @@ -328,7 +331,7 @@ describe(`AppConfigService`, (): void => {
newValue: `dummy-initialization-date`,
oldValue: `initialization-date`,
valueName: `initialization date`
});
} as IConfigUpdateString);
});

it(`should update the app config initialization date with the updated string`, (): void => {
Expand Down Expand Up @@ -431,7 +434,7 @@ describe(`AppConfigService`, (): void => {
newValue: false,
oldValue: true,
valueName: `production state`
});
} as IConfigUpdateBoolean);
});

it(`should update the app config production state with the updated boolean`, (): void => {
Expand Down Expand Up @@ -542,7 +545,7 @@ describe(`AppConfigService`, (): void => {
newValue: 8,
oldValue: 5,
valueName: `total release count`
});
} as IConfigUpdateNumber);
});

it(`should update the app config total release count with the updated number`, (): void => {
Expand Down Expand Up @@ -588,11 +591,11 @@ describe(`AppConfigService`, (): void => {
expect(configServiceGetUpdatedStringSpy).toHaveBeenCalledTimes(1);
expect(configServiceGetUpdatedStringSpy).toHaveBeenCalledWith({
context: `AppConfigService`,
isValueHidden: true,
isValueDisplay: false,
newValue: `dummy-release-notes`,
oldValue: `release-notes`,
valueName: `release notes`
});
} as IConfigUpdateString);
});

it(`should update the app config release notes with the updated string`, (): void => {
Expand Down
2 changes: 1 addition & 1 deletion src/features/app/services/app-config-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class AppConfigService extends AbstractConfigService<IAppConfig> {
public updateReleaseNotes(releaseNotes?: Readonly<string>): void {
APP_CONFIG.releaseNotes = this._configService.getUpdatedString({
context: this._className,
isValueHidden: true,
isValueDisplay: false,
newValue: releaseNotes,
oldValue: APP_CONFIG.releaseNotes,
valueName: `release notes`
Expand Down
1 change: 1 addition & 0 deletions src/features/config/interfaces/config-update-string.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IConfigUpdateValue } from './config-update-value';

export interface IConfigUpdateString extends IConfigUpdateValue<string> {
isValueDisplay?: boolean;
isValueHidden?: boolean;
}
Loading

0 comments on commit aceee56

Please sign in to comment.