Skip to content

Commit

Permalink
chore: move unit tests to correct place for mssql and postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
ujjwal-ab committed Sep 26, 2023
1 parent e7dbd2c commit cf85f2b
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 100 deletions.
48 changes: 48 additions & 0 deletions src/v0/destinations/mssql/transform.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const { getDataType } = require('../../../../src/warehouse/index');
const { getDataTypeOverride } = require('./transform');

var testCases = [
{
name: 'normalInt',
data: 1,
type: 'int',
},
{
name: 'normalFloat',
data: 2.01,
type: 'float',
},
{
name: 'normalBoolean',
data: true,
type: 'boolean',
},
{
name: 'normalString',
data: 'mssql transformation[*007}',
type: 'string',
},
{
name: 'violationErrors',
data: [
{
message:
'no schema for eventName : Product Purchased new, eventType : track in trackingPlanID : tp_20dfXJDpotQWHe7hMxfQfgWMZDv::1',
meta: {},
type: 'Unplanned-Event',
},
],
type: 'string',
},
];

describe('MSSQL data types testing', () => {
let options = {};
options.getDataTypeOverride = getDataTypeOverride;
testCases.forEach((testCase) => {
it(`should return data type ${testCase.type} for this input data ${testCase.data} everytime`, () => {
var dataType = getDataType(testCase.name, testCase.data, options);
expect(dataType).toEqual(testCase.type);
});
});
});
48 changes: 48 additions & 0 deletions src/v0/destinations/postgres/transform.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const { getDataType } = require('../../../../src/warehouse/index');
const { getDataTypeOverride } = require('./transform');

var testCases = [
{
name: 'normalInt',
data: 1,
type: 'int',
},
{
name: 'normalFloat',
data: 2.01,
type: 'float',
},
{
name: 'normalBoolean',
data: true,
type: 'boolean',
},
{
name: 'normalString',
data: 'postgres transformation[*007}',
type: 'string',
},
{
name: 'violationErrors',
data: [
{
message:
'no schema for eventName : Product Purchased new, eventType : track in trackingPlanID : tp_20dfXJDpotQWHe7hMxfQfgWMZDv::1',
meta: {},
type: 'Unplanned-Event',
},
],
type: 'json',
},
];

describe('Postgres data types testing', () => {
let options = {};
options.getDataTypeOverride = getDataTypeOverride;
testCases.forEach((testCase) => {
it(`should return data type ${testCase.type} for this input data ${testCase.data} everytime`, () => {
var dataType = getDataType(testCase.name, testCase.data, options);
expect(dataType).toEqual(testCase.type);
});
});
});
50 changes: 0 additions & 50 deletions test/__tests__/mssql.test.js

This file was deleted.

50 changes: 0 additions & 50 deletions test/__tests__/postgres.test.js

This file was deleted.

0 comments on commit cf85f2b

Please sign in to comment.