Skip to content

Commit

Permalink
fix(cb2-7666): global find and replace axle to fifth wheel coupling (#16
Browse files Browse the repository at this point in the history
)
  • Loading branch information
HazelWilderspin authored Mar 3, 2023
1 parent 4db659f commit 7f65412
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/createTimestampRecord.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ const dbRecord = {
'euroStandard': {
'S': '7',
},
'frontAxleTo5thWheelCouplingMax': {
'frontVehicleTo5thWheelCouplingMax': {
'N': '1900',
},
'frontAxleTo5thWheelCouplingMin': {
'frontVehicleTo5thWheelCouplingMin': {
'N': '1700',
},
'frontAxleTo5thWheelMax': {
Expand Down Expand Up @@ -510,8 +510,8 @@ const transformedRecord = {
techRecord_dimensions_width: 2200,
techRecord_drawbarCouplingFitted: true,
techRecord_euroStandard: '7',
techRecord_frontAxleTo5thWheelCouplingMax: 1900,
techRecord_frontAxleTo5thWheelCouplingMin: 1700,
techRecord_frontVehicleTo5thWheelCouplingMax: 1900,
techRecord_frontVehicleTo5thWheelCouplingMin: 1700,
techRecord_frontAxleTo5thWheelMax: 1500,
techRecord_frontAxleTo5thWheelMin: 1200,
techRecord_functionCode: 'A',
Expand Down Expand Up @@ -551,26 +551,26 @@ describe('createTimestampRecord', () => {
const techRecords = newImage.techRecord;
delete newImage.techRecord;
const result = createTimestampRecord(newImage, techRecords[0]);

// Ensure result only contains: string, number, array, null or boolean types. No objects
const expectation = Object.values(result).every(entry => {
return typeof(entry) === 'string' ? true
return typeof(entry) === 'string' ? true
: typeof(entry) === 'number' ? true
: Array.isArray(entry) ? true
: Array.isArray(entry) ? true
: typeof(entry) === 'boolean' ? true
: entry === null ? true
: entry === null ? true
: false;
});

expect(expectation).toBeTruthy();
});

it('should transform the dynamodb record correctly', () => {
const newImage = DynamoDB.Converter.unmarshall(dbRecord.dynamodb.NewImage) as LegacyVehicleRecord;
const techRecords = newImage.techRecord;
delete newImage.techRecord;
const result = createTimestampRecord(newImage, techRecords[0]);

expect(result).toEqual(transformedRecord);
});
});

0 comments on commit 7f65412

Please sign in to comment.