Skip to content

Commit

Permalink
fix: format test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sharmyn28 committed Oct 11, 2023
1 parent 783db0c commit 2908f31
Showing 1 changed file with 44 additions and 30 deletions.
Original file line number Diff line number Diff line change
@@ -1,59 +1,73 @@
import {getExpressionDescription} from "../expressionHelper";
import { getExpressionDescription } from '../expressionHelper'

const attributes = [
{
id: "w75KJ2mc4zz",
name: "First name",
valueType: "TEXT"
id: 'w75KJ2mc4zz',
name: 'First name',
valueType: 'TEXT',
},
{
id: "zDhUuAYrxNC",
name: "Last name",
valueType: "TEXT"
id: 'zDhUuAYrxNC',
name: 'Last name',
valueType: 'TEXT',
},
{
id: "cejWyOfXge6",
name: "Gender",
valueType: "TEXT"
id: 'cejWyOfXge6',
name: 'Gender',
valueType: 'TEXT',
},
{
id: "lZGmxYbs97q",
name: "Unique ID",
valueType: "TEXT"
id: 'lZGmxYbs97q',
name: 'Unique ID',
valueType: 'TEXT',
},
{
id: "iESIqZ0R0R0",
name: "Date of birth",
valueType: "DATE"
}
id: 'iESIqZ0R0R0',
name: 'Date of birth',
valueType: 'DATE',
},
]

test('From a list of attributes you can get this expression', () => {
const expression = "A{w75KJ2mc4zz} A{zDhUuAYrxNC}, if(A{cejWyOfXge6} == 'Male', 'M', 'F')"
const resultExpression = "First name Last name, if(Gender == 'Male', 'M', 'F')"
expect(getExpressionDescription(expression, attributes)).toMatch(resultExpression)
const expression =
"A{w75KJ2mc4zz} A{zDhUuAYrxNC}, if(A{cejWyOfXge6} == 'Male', 'M', 'F')"
const resultExpression =
"First name Last name, if(Gender == 'Male', 'M', 'F')"
expect(getExpressionDescription(expression, attributes)).toMatch(
resultExpression
)
})

test('From a list of attributes you can get this expression', () => {
const expression = "A{w75KJ2mc4zz} + A{zDhUuAYrxNC}"
const resultExpression = "First name + Last name"
expect(getExpressionDescription(expression, attributes)).toMatch(resultExpression)
const expression = 'A{w75KJ2mc4zz} + A{zDhUuAYrxNC}'
const resultExpression = 'First name + Last name'
expect(getExpressionDescription(expression, attributes)).toMatch(
resultExpression
)
})

test('From a list of attributes you can get this expression', () => {
const expression = "A{w75KJ2mc4zz} + A{cejWyOfXge6}"
const resultExpression = "First name + Gender"
expect(getExpressionDescription(expression, attributes)).toMatch(resultExpression)
const expression = 'A{w75KJ2mc4zz} + A{cejWyOfXge6}'
const resultExpression = 'First name + Gender'
expect(getExpressionDescription(expression, attributes)).toMatch(
resultExpression
)
})

test('From a list of attributes you can get this expression', () => {
const expression = "d2:concatenate(A{w75KJ2mc4zz}, ' ', A{zDhUuAYrxNC})"
const resultExpression = "d2:concatenate(First name, ' ', Last name)"
expect(getExpressionDescription(expression, attributes)).toMatch(resultExpression)
expect(getExpressionDescription(expression, attributes)).toMatch(
resultExpression
)
})

test('From a list of attributes you can get this expression', () => {
const expression = "d2:concatenate(A{w75KJ2mc4zz}, ' ', A{zDhUuAYrxNC}, ', ', A{iESIqZ0R0R0})"
const resultExpression = "d2:concatenate(First name, ' ', Last name, ', ', Date of birth)"
expect(getExpressionDescription(expression, attributes)).toMatch(resultExpression)
const expression =
"d2:concatenate(A{w75KJ2mc4zz}, ' ', A{zDhUuAYrxNC}, ', ', A{iESIqZ0R0R0})"
const resultExpression =
"d2:concatenate(First name, ' ', Last name, ', ', Date of birth)"
expect(getExpressionDescription(expression, attributes)).toMatch(
resultExpression
)
})

0 comments on commit 2908f31

Please sign in to comment.