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

fix(http): fix unit tests. Enhance http demo in Starter #268

Merged
merged 8 commits into from
Mar 23, 2018

Conversation

christophercr
Copy link
Collaborator

@christophercr christophercr commented Mar 23, 2018

Closes #96

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[X] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

  • LoggingService and SessionService injections commented since they are not yet implemented
  • Only 50% unit tests passing.

Issue Number: #96

What is the new behavior?

  • LoggingService and SessionService injections are now used in the service. They are mocked via a factory in the StarkHttp module as a temporary solution until such services are implemented
  • 100% unit tests passing

Does this PR introduce a breaking change?

[ ] Yes
[X] No

Other information

Since the LoggingService and the SessionService are not yet implemented, they are mocked and passed to the service via a factory:

const starkHttpServiceFactory = (httpClient: HttpClient) => {
	const logger: any = {
		debug: console.debug,
		warn: console.warn,
		error: console.error,
		correlationId: "dummy-correlation-id"
	};

	const sessionService: any = {
		fakePreAuthenticationHeaders: new Map<string, string>([
			["nbb-dummy-header", "some value"], ["nbb-another-header", "whatever"]
		])
	};

	return new StarkHttpServiceImpl(logger, sessionService, httpClient)
};

@NgModule({
	imports: [
		HttpClientModule
	],
	providers: [
		// FIXME: replace this Factory provider by a simple Class provider once LoggingService and SessionService are implemented
		{provide: starkHttpServiceName, useFactory: starkHttpServiceFactory, deps: [HttpClient]},
	]
})
export class StarkHttpModule {}

@dsebastien dsebastien merged commit 6d609b8 into NationalBankBelgium:master Mar 23, 2018
@SuperITMan SuperITMan modified the milestone: 10.0.0-alpha.1 Mar 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

core: http
3 participants