-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from paddls/feature/add_provide_methods
feat: add provide method
- Loading branch information
Showing
15 changed files
with
304 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
projects/ngx-firestore-repository/src/lib/ngx-firestore-repository.module.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import {TestBed} from '@angular/core/testing'; | ||
import { | ||
NgxFirestoreRepositoryModule, | ||
NgxFirestoreRepositoryModuleConfiguration, | ||
provideNgxFirestoreRepository | ||
} from './ngx-firestore-repository.module'; | ||
import {LogExecuteFirestoreRequestEventListener} from './driver/listener/log-execute-firestore-request-event.listener'; | ||
import {FIRESTORE_APP} from './ngx-firestore-repository.module.di'; | ||
import {FirestoreNormalizer} from './normalizer/firestore.normalizer'; | ||
|
||
|
||
describe('NgxFirestoreRepositoryModule.forRoot', () => { | ||
const config: NgxFirestoreRepositoryModuleConfiguration = { | ||
debug: true | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [NgxFirestoreRepositoryModule.forRoot(config)], | ||
}); | ||
}); | ||
|
||
testFirestoreRepository(); | ||
}); | ||
|
||
describe('provideNgxFirestoreRepositoryModule', () => { | ||
|
||
const config: NgxFirestoreRepositoryModuleConfiguration = { | ||
debug: true | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [NgxFirestoreRepositoryModule], | ||
providers: [ | ||
provideNgxFirestoreRepository(config), | ||
] | ||
}); | ||
}); | ||
testFirestoreRepository(); | ||
}); | ||
|
||
function testFirestoreRepository() { | ||
it('should provide FirestoreRepositoryBuilder', () => { | ||
expect(() => TestBed.inject(FIRESTORE_APP)).toBeTruthy(); | ||
}); | ||
|
||
it('should not provide FirestoreNormalizer', () => { | ||
expect(() => TestBed.inject(FirestoreNormalizer)).toThrowError(/No provider for/); | ||
}); | ||
|
||
it('should provide LogExecuteFirestoreRequestEventListener when debug is true', () => { | ||
expect(TestBed.inject(LogExecuteFirestoreRequestEventListener)).toBeTruthy(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
projects/ngx-http-repository/src/lib/ngx-http-repository.module.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {TestBed} from '@angular/core/testing'; | ||
import { | ||
NgxHttpRepositoryModule, | ||
NgxHttpRepositoryModuleConfiguration, | ||
provideNgxHttpRepositoryModule | ||
} from './ngx-http-repository.module'; | ||
import {LogExecuteHttpRequestEventListener} from './driver/listener/log-execute-http-request-event.listener'; | ||
import {HTTP_REPOSITORY_CONFIGURATION} from './configuration/http-repository.configuration'; | ||
import {HttpRepositoryBuilder} from './repository/http-repository.builder'; | ||
|
||
describe('NgxHttpRepositoryModule.forRoot', () => { | ||
const config: NgxHttpRepositoryModuleConfiguration = { | ||
debug: true | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
imports: [NgxHttpRepositoryModule.forRoot(config)] | ||
}); | ||
}); | ||
testHttpRepository(); | ||
}); | ||
|
||
describe('provideNgxHttpRepositoryModule', () => { | ||
const config: NgxHttpRepositoryModuleConfiguration = { | ||
debug: true | ||
}; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
providers: [ | ||
provideNgxHttpRepositoryModule(config) | ||
] | ||
}); | ||
}); | ||
testHttpRepository(); | ||
}); | ||
|
||
function testHttpRepository() { | ||
|
||
it('should provide HttpRepositoryBuilder', () => { | ||
expect(() => TestBed.inject(HTTP_REPOSITORY_CONFIGURATION)).toBeTruthy(); | ||
}); | ||
|
||
it('should not provide HttpRepositoryDriver', () => { | ||
expect(() => TestBed.inject(HttpRepositoryBuilder)).toThrowError(/No provider for/); | ||
}); | ||
|
||
it('should provide LogExecuteHttpRequestEventListener when debug is true', () => { | ||
expect(TestBed.inject(LogExecuteHttpRequestEventListener)).toBeTruthy(); | ||
}); | ||
} |
Oops, something went wrong.