2018-10-24 00:39:02 +08:00
|
|
|
'use strict';
|
|
|
|
|
2018-08-16 19:55:39 +08:00
|
|
|
var assert = require('assert');
|
2019-10-07 17:29:07 +08:00
|
|
|
var dateWrapper = require('../../../lib/utils/date-wrapper');
|
2018-08-16 19:55:39 +08:00
|
|
|
|
2019-10-22 01:07:24 +08:00
|
|
|
describe('date-wrapper', function () {
|
|
|
|
it('should wrap property fields with spaces', function () {
|
2018-08-16 19:55:39 +08:00
|
|
|
const actual = dateWrapper.wrapDates(
|
2019-10-22 01:07:24 +08:00
|
|
|
'select * from table',
|
|
|
|
[{ name: 'a' }, { name: 'b c' }]
|
2018-08-16 19:55:39 +08:00
|
|
|
);
|
|
|
|
const expected = `
|
|
|
|
SELECT
|
|
|
|
"a","b c"
|
|
|
|
FROM
|
|
|
|
(select * from table) _cdb_epoch_transformation `;
|
|
|
|
assert.equal(actual, expected);
|
|
|
|
});
|
|
|
|
});
|