@@ -29,7 +29,7 @@ describe('custom-models.spec.ts', async () => {
2929 ` ) ,
3030 ) ;
3131
32- const indexFile = await boats ( 'test/output/custom/src/index.yml' , 'test/output/custom/api.json' ) ;
32+ const indexFile = await boats ( 'test/output/custom/src/index.yml' , 'test/output/custom/build/ api.json' ) ;
3333
3434 assert . strictEqual ( indexFile !== '' , true , 'boats failed' ) ;
3535 assert . strictEqual ( await getFile ( indexFile ) , await getFile ( 'test/fixtures/spec/custom.json' ) , 'spec mismatch' ) ;
@@ -96,38 +96,30 @@ describe('custom-models.spec.ts', async () => {
9696 --quiet
9797 --output test/output/custom
9898 -T test/fixtures/overrides/module.js
99+ --templates test/fixtures/overrides
100+ --templates test/fixtures/overrides/single-export/
99101 ` ) ,
100102 ) ;
101103
102- const files = await getAllFiles ( 'test/output/custom/' ) ;
103- assert . deepStrictEqual ( files , [
104- 'test/output/custom/.boatsrc' ,
105- 'test/output/custom/src/components/parameters/index.yml' ,
106- 'test/output/custom/src/components/parameters/pathUserId.yml' ,
107- 'test/output/custom/src/components/parameters/queryLimit.yml' ,
108- 'test/output/custom/src/components/parameters/queryOffset.yml' ,
109- 'test/output/custom/src/components/parameters/queryUserId.yml' ,
110- 'test/output/custom/src/components/schemas/index.yml' ,
111- 'test/output/custom/src/components/schemas/jwt/model.yml' ,
112- 'test/output/custom/src/components/schemas/pagination/model.yml' ,
113- 'test/output/custom/src/components/schemas/user/model.yml' ,
114- 'test/output/custom/src/components/schemas/user/models.yml' ,
115- 'test/output/custom/src/components/schemas/user/patch.yml' ,
116- 'test/output/custom/src/components/schemas/user/post.yml' ,
117- 'test/output/custom/src/components/schemas/user/put.yml' ,
118- 'test/output/custom/src/index.yml' ,
119- 'test/output/custom/src/paths/index.yml' ,
120- 'test/output/custom/src/paths/users/get.yml' ,
121- 'test/output/custom/src/paths/users/post.yml' ,
122- 'test/output/custom/src/paths/users/{userId}/delete.yml' ,
123- 'test/output/custom/src/paths/users/{userId}/get.yml' ,
124- 'test/output/custom/src/paths/users/{userId}/patch.yml' ,
125- 'test/output/custom/src/paths/users/{userId}/put.yml' ,
126- ] ) ;
104+ const indexFile = await boats ( 'test/output/custom/src/index.yml' , 'test/output/custom/build/api.json' ) ;
105+
106+ assert . strictEqual ( indexFile !== '' , true , 'boats failed' ) ;
107+ assert . strictEqual ( await getFile ( indexFile ) , await getFile ( 'test/fixtures/spec/custom-multi.json' ) , 'spec mismatch' ) ;
108+ } ) ;
109+
110+ await it ( 'adds and overwrites templates when invoked multiple times' , async ( ) => {
111+ assert . deepStrictEqual ( await getAllFiles ( 'test/output/custom/' ) . catch ( ( ) => [ ] ) , [ ] ) ;
127112
128- for ( const file of await getAllFiles ( 'test/output/custom/' ) ) {
129- assert . deepStrictEqual ( await getFile ( file ) , file . replace ( 'test/output/custom/' , '' ) ) ;
130- }
113+ await cli (
114+ toArgv ( `
115+ path users/:userId -crudl --put
116+ model jwt
117+ model userId --type query
118+ --quiet
119+ --output test/output/custom
120+ -T test/fixtures/overrides/module.js
121+ ` ) ,
122+ ) ;
131123 } ) ;
132124
133125 await it ( 'outputs a meaningful error message' , async ( ) => {
0 commit comments