Skip to content

Commit 23f60f3

Browse files
committed
test uri transformation
1 parent 789a302 commit 23f60f3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

test/app.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ module.exports = _.defaultsDeep({
193193
dialect: 'sqlite',
194194
storage: './test/test.sqlite',
195195
database: 'test'
196+
},
197+
uristore: {
198+
uri: 'sqlite://testuser:password@testhost:1234/testdb'
196199
}
197200
},
198201
models: {

test/lib/transformer.test.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,18 @@ describe('lib.Transformer', () => {
3232
assert(connections.teststore)
3333
assert.equal(connections.storeoverride.options.dialect, 'sqlite')
3434
})
35+
it('should transform uri properly', () => {
36+
const connections = lib.Transformer.transformStores(global.app)
37+
assert(connections.uristore)
38+
assert.equal(connections.uristore.options.dialect, 'sqlite')
39+
assert.equal(connections.uristore.options.host, 'testhost')
40+
assert.equal(connections.uristore.config.host, 'testhost')
41+
assert.equal(connections.uristore.config.database, 'testdb')
42+
// test config for other dialects
43+
assert.equal(connections.uristore.config.port, 1234)
44+
assert.equal(connections.uristore.config.username, 'testuser')
45+
assert.equal(connections.uristore.config.password, 'password')
46+
})
3547
})
3648

3749
})

0 commit comments

Comments
 (0)