File tree Expand file tree Collapse file tree 5 files changed +28
-12
lines changed Expand file tree Collapse file tree 5 files changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ npm-debug.log
1111.DS_Store
1212
1313# tests
14- /test
14+ ! tests /data /.gitkeep
15+
1516/coverage
1617/.nyc_output
1718
1819# dist
19- dist
20+ dist
Original file line number Diff line number Diff line change 11import { INestApplication } from '@nestjs/common' ;
22import { Test } from '@nestjs/testing' ;
33import { AppModule } from '../src/app.module' ;
4+ import { StorageService } from '../../lib' ;
45
5- describe ( 's3 driver' , ( ) => {
6+ describe ( 'local driver' , async ( ) => {
67 let app : INestApplication ;
8+ let storageService ;
79
810 beforeEach ( async ( ) => {
911 const moduleRef = await Test . createTestingModule ( {
10- imports : [ AppModule . withStorage ( ) ] ,
12+ imports : [ AppModule . withLocalStorage ( ) ] ,
1113 } ) . compile ( ) ;
1214
1315 app = moduleRef . createNestApplication ( ) ;
1416 await app . init ( ) ;
1517 } ) ;
1618
17- it ( `should load configuration with "s3 driver"` , ( ) => {
18- expect ( 'a' ) . toEqual ( 'a' ) ;
19+ it ( `should load configuration with "local driver"` , async ( ) => {
20+ storageService = app . get < StorageService > ( StorageService ) ;
1921 } ) ;
2022
23+ it ( `put ` ) ;
24+
2125 afterEach ( async ( ) => {
2226 await app . close ( ) ;
2327 } ) ;
Original file line number Diff line number Diff line change @@ -6,13 +6,26 @@ import { StorageService } from '../../lib/storage.service';
66@Module ( { } )
77export class AppModule {
88 constructor ( private readonly storageService : StorageService ) {
9- console . log ( storageService ) ;
9+ console . log ( 'AppModule constructor' , storageService ) ;
1010 }
1111
12- static withStorage ( ) : DynamicModule {
12+ static withLocalStorage ( ) : DynamicModule {
13+ console . log ( 'withLocalStorage' ) ;
1314 return {
1415 module : AppModule ,
15- imports : [ StorageModule . forRoot ( ) ] ,
16+ imports : [
17+ StorageModule . forRoot ( {
18+ default : 'local' ,
19+ disks : {
20+ local : {
21+ driver : 'local' ,
22+ config : {
23+ root : process . cwd ( ) ,
24+ } ,
25+ } ,
26+ } ,
27+ } ) ,
28+ ] ,
1629 } ;
1730 }
1831}
Original file line number Diff line number Diff line change 33 "compilerOptions" : {
44 "outDir" : " ../../dist/out-tsc" ,
55 "module" : " commonjs" ,
6- "types" : [" jest" , " node" ],
7- "rootDir" : " ." ,
8- "baseUrl" : " ."
6+ "types" : [" jest" , " node" ]
97 },
108 "include" : [
119 " **/*.spec.ts" ,
You can’t perform that action at this time.
0 commit comments