Skip to content

Commit

Permalink
test : add tests for numeric variables
Browse files Browse the repository at this point in the history
  • Loading branch information
QRuhier committed Nov 29, 2024
1 parent a1d4e9f commit 6e1b92e
Show file tree
Hide file tree
Showing 5 changed files with 296 additions and 107 deletions.
142 changes: 70 additions & 72 deletions src/model/transformations/calculated-variable.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
VARIABLES_TYPES,
} from '../../constants/pogues-constants';

const { TEXT } = DATATYPE_NAME;
const { TEXT, NUMERIC } = DATATYPE_NAME;

const { CALCULATED } = VARIABLES_TYPES;

Expand All @@ -22,11 +22,6 @@ describe('calculated variables tranformations', () => {
Datatype: {
MaxLength: 2,
Pattern: '',
Minimum: '',
Maximum: '',
Decimals: '',
Unit: '',
Format: '',
type: 'TextDatatypeType',
typeName: TEXT,
},
Expand All @@ -38,15 +33,13 @@ describe('calculated variables tranformations', () => {
Formula: 'formula 2',
Scope: 'jbcggtca',
Datatype: {
MaxLength: 2,
Pattern: '',
Minimum: '',
Maximum: '',
Minimum: '1',
Maximum: '10',
Decimals: '',
Unit: '',
Format: '',
type: 'TextDatatypeType',
typeName: TEXT,
IsDynamicUnit: false,
Unit: 'euro',
type: 'NumericDatatypeType',
typeName: NUMERIC,
},
},
{
Expand All @@ -55,15 +48,13 @@ describe('calculated variables tranformations', () => {
Name: 'name 3',
Formula: 'formula 3',
Datatype: {
MaxLength: 3,
Pattern: '',
Minimum: '',
Maximum: '',
Decimals: '',
Unit: '',
Format: '',
type: 'TextDatatypeType',
typeName: TEXT,
Minimum: '1',
Maximum: '10',
Decimals: '2',
IsDynamicUnit: true,
Unit: 'my formula',
type: 'NumericDatatypeType',
typeName: NUMERIC,
},
},
];
Expand All @@ -79,11 +70,6 @@ describe('calculated variables tranformations', () => {
[TEXT]: {
maxLength: 2,
pattern: '',
minimum: '',
maximum: '',
decimals: '',
unit: '',
format: '',
},
},
2: {
Expand All @@ -92,15 +78,13 @@ describe('calculated variables tranformations', () => {
name: 'name 2',
formula: 'formula 2',
scope: 'jbcggtca',
type: TEXT,
[TEXT]: {
maxLength: 2,
pattern: '',
minimum: '',
maximum: '',
type: NUMERIC,
[NUMERIC]: {
minimum: '1',
maximum: '10',
decimals: '',
unit: '',
format: '',
isDynamicUnit: false,
unit: 'euro',
},
},
3: {
Expand All @@ -109,15 +93,13 @@ describe('calculated variables tranformations', () => {
name: 'name 3',
formula: 'formula 3',
scope: '',
type: TEXT,
[TEXT]: {
maxLength: 3,
pattern: '',
minimum: '',
maximum: '',
decimals: '',
unit: '',
format: '',
type: NUMERIC,
[NUMERIC]: {
minimum: '1',
maximum: '10',
decimals: '2',
isDynamicUnit: true,
unit: 'my formula',
},
},
});
Expand Down Expand Up @@ -145,31 +127,27 @@ describe('calculated variables tranformations', () => {
Name: 'name 2',
Formula: 'formula 2',
Datatype: {
MaxLength: 3,
Pattern: '',
Minimum: '',
Maximum: '',
Minimum: '1',
Maximum: '10',
Decimals: '',
Unit: '',
Format: '',
type: 'TextDatatypeType',
typeName: TEXT,
IsDynamicUnit: false,
Unit: 'euro',
type: 'NumericDatatypeType',
typeName: NUMERIC,
},
},
{
Label: 'label 3',
Name: 'name 3',
Formula: 'formula 3',
Datatype: {
MaxLength: 3,
Pattern: '',
Minimum: '',
Maximum: '',
Decimals: '',
Unit: '',
Format: '',
type: 'TextDatatypeType',
typeName: TEXT,
Minimum: '1',
Maximum: '10',
Decimals: '2',
IsDynamicUnit: true,
Unit: 'my formula',
type: 'NumericDatatypeType',
typeName: NUMERIC,
},
},
];
Expand All @@ -194,16 +172,28 @@ describe('calculated variables tranformations', () => {
name: 'name 2',
formula: 'formula 2',
scope: 'jbcggtca',
type: TEXT,
[TEXT]: { maxLength: 2 },
type: NUMERIC,
[NUMERIC]: {
minimum: '1',
maximum: '10',
decimals: '',
isDynamicUnit: false,
unit: 'euro',
},
},
3: {
id: '3',
label: 'label 3',
name: 'name 3',
formula: 'formula 3',
type: TEXT,
[TEXT]: { maxLength: 3 },
type: NUMERIC,
[NUMERIC]: {
minimum: '1',
maximum: '10',
decimals: '2',
isDynamicUnit: true,
unit: 'my formula',
},
},
};

Expand All @@ -228,9 +218,13 @@ describe('calculated variables tranformations', () => {
type: CALCULATED,
Scope: 'jbcggtca',
Datatype: {
MaxLength: 2,
type: 'TextDatatypeType',
typeName: TEXT,
Minimum: '1',
Maximum: '10',
Decimals: '',
IsDynamicUnit: false,
Unit: 'euro',
type: 'NumericDatatypeType',
typeName: NUMERIC,
},
},
{
Expand All @@ -240,9 +234,13 @@ describe('calculated variables tranformations', () => {
Formula: 'formula 3',
type: CALCULATED,
Datatype: {
MaxLength: 3,
type: 'TextDatatypeType',
typeName: TEXT,
Minimum: '1',
Maximum: '10',
Decimals: '2',
IsDynamicUnit: true,
Unit: 'my formula',
type: 'NumericDatatypeType',
typeName: NUMERIC,
},
},
]);
Expand Down
Loading

0 comments on commit 6e1b92e

Please sign in to comment.