forked from sqlpad/sqlpad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrender-connection.js
More file actions
33 lines (31 loc) · 1.03 KB
/
render-connection.js
File metadata and controls
33 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const assert = require('assert');
const renderConnection = require('../../lib/render-connection');
describe('lib/render-connection', function () {
it('renders connection with user', function () {
const secret = '123<>!@#$%^&*()-_+=';
const user = {
data: {
secret,
},
};
const connection = {
connectionString: '{{user.data.secret}}',
singleStache: '{single}',
port: 6543,
};
const rendered = renderConnection(connection, user);
assert.strictEqual(rendered.connectionString, secret);
assert.strictEqual(rendered.singleStache, '{single}', 'single left alone');
assert.strictEqual(rendered.port, 6543, 'number left alone');
});
it('renders connection without user', function () {
const connection = {
connectionString: 'test',
singleStache: '{single}',
port: 6543,
};
const rendered = renderConnection(connection);
assert.strictEqual(rendered.connectionString, 'test');
assert.strictEqual(rendered.singleStache, '{single}');
});
});