Skip to content

Commit

Permalink
Merge branch 'master' into apdex-automation-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafa committed Aug 27, 2024
2 parents 6f9e91d + 5343976 commit f8a9c22
Show file tree
Hide file tree
Showing 27 changed files with 32 additions and 6,263 deletions.
2 changes: 1 addition & 1 deletion api/src/services/report/smsparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const T_TABLE = {
// TODO ensure everything in here is still needed
const digitReplacer = c => T_TABLE[c];
const standardiseDigits = original => {
return original && original.toString().replace(/[०-९]/g, digitReplacer);
return original && stripInvisibleCharacters(original.toString().replace(/[०-९]/g, digitReplacer));
};

const isMuvukuFormat = (exports.isMuvukuFormat = msg => {
Expand Down
31 changes: 31 additions & 0 deletions api/tests/mocha/services/report/smsparser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1670,4 +1670,35 @@ describe('sms parser', () => {
chai.expect(config.translate.callCount).to.equal(2);
});

it('should correctly parse and standardize BS Year from Devanagari digits using parseField', () => {
const bsYearField = { type: 'bsYear' };
const input = '२०८०'; // 2080 in Devanagari
const expected = '2080';
const result = smsparser.parseField(bsYearField, input, 'year');
chai.expect(result).to.equal(expected);
});

it('should correctly parse and standardize BS Month from Devanagari digits using parseField', () => {
const bsMonthField = { type: 'bsMonth' };
const input = '०४'; // 04 in Devanagari
const expected = '04';
const result = smsparser.parseField(bsMonthField, input, 'month');
chai.expect(result).to.equal(expected);
});

it('should correctly parse and standardize BS Day from Devanagari digits using parseField', () => {
const bsDayField = { type: 'bsDay' };
const input = '१५'; // 15 in Devanagari
const expected = '15';
const result = smsparser.parseField(bsDayField, input, 'day');
chai.expect(result).to.equal(expected);
});

it('should correctly parse and standardize BS Year from Devanagari digits and strip invisible characters', () => {
const bsYearField = { type: 'bsYear' };
const input = '२\u200B०८०'; // 2080 in Devanagari with a zero-width space
const expected = '2080';
const result = smsparser.parseField(bsYearField, input, 'year');
chai.expect(result).to.equal(expected);
});
});
13 changes: 0 additions & 13 deletions shared-libs/bulk-docs-utils/package-lock.json

This file was deleted.

31 changes: 0 additions & 31 deletions shared-libs/calendar-interval/package-lock.json

This file was deleted.

13 changes: 0 additions & 13 deletions shared-libs/cht-datasource/package-lock.json

This file was deleted.

13 changes: 0 additions & 13 deletions shared-libs/contact-types-utils/package-lock.json

This file was deleted.

76 changes: 0 additions & 76 deletions shared-libs/contacts/package-lock.json

This file was deleted.

Loading

0 comments on commit f8a9c22

Please sign in to comment.