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

test: replace core-js with @abraham/reflection for tests #5

Merged
merged 1 commit into from
Jul 26, 2018
Merged
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
test: replace core-js with @abraham/reflection for tests
- build: bump to latest reflection
  • Loading branch information
Hotell committed Jul 26, 2018
commit abbc198060bcf6cc5f12ac65c64f5ce88b543451
3 changes: 2 additions & 1 deletion config/setup-tests.js
Original file line number Diff line number Diff line change
@@ -6,4 +6,5 @@
// for more docs check see https://jestjs.io/docs/en/configuration.html#setupfiles-array

// @ts-ignore
require('core-js/es7/reflect')
// require('core-js/es7/reflect')
require('@abraham/reflection')
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -76,8 +76,10 @@
"tslib": ">=1.9.0",
"injection-js": ">=2.2.1"
},
"dependencies": {},
"dependencies": {
},
"devDependencies": {
"@abraham/reflection": "0.4.0",
"@types/jest": "23.1.6",
"@types/node": "10.5.2",
"@types/prettier": "1.13.2",
5 changes: 2 additions & 3 deletions src/__tests__/http-client.spec.ts
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@ import {
HttpInterceptorHandler,
NoopInterceptor,
} from '../interceptor'
import { registerHttpClientProviders } from '../module'
import { _AxiosInterceptors, HttpRequest, HttpResponse } from '../types'

describe(`HttpClient`, () => {
@@ -85,9 +86,7 @@ describe(`HttpClient`, () => {

it(`should support interceptors via mutli:true`, () => {
const injector = ReflectiveInjector.resolveAndCreate([
HttpClient,
HttpInterceptorHandler,
{ provide: HTTP_INTERCEPTORS, useClass: NoopInterceptor, multi: true },
registerHttpClientProviders(),
{ provide: HTTP_INTERCEPTORS, useClass: TestInterceptor, multi: true },
])

13 changes: 13 additions & 0 deletions src/__tests__/module.spec.ts
Original file line number Diff line number Diff line change
@@ -24,4 +24,17 @@ describe(`HttpClientModule`, () => {

expect(httpClient).toBeInstanceOf(HttpClient)
})

it(`should support configuration on register`, () => {
const providers = registerHttpClientProviders({
baseURL: 'https://api.githup.com',
})

const injector = ReflectiveInjector.resolveAndCreate(providers)

const httpClient: HttpClient = injector.get(HttpClient)

expect(httpClient).toBeInstanceOf(HttpClient)
expect(httpClient.defaults.baseURL).toBe('https://api.githup.com')
})
})
3 changes: 0 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -32,9 +32,6 @@
"exclude": [
"node_modules",
"dist"
// "__tests__",
// "**/*.spec.ts",
// "**/*.test.ts"
],
"compileOnSave": false,
"buildOnSave": false
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -2,6 +2,10 @@
# yarn lockfile v1


"@abraham/reflection@0.4.0":
version "0.4.0"
resolved "https://registry.yarnpkg.com/@abraham/reflection/-/reflection-0.4.0.tgz#2dc10c5e17db4100e343ae7ad51458021cd9130b"

"@babel/code-frame@^7.0.0-beta.35":
version "7.0.0-beta.49"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.0.0-beta.49.tgz#becd805482734440c9d137e46d77340e64d7f51b"