Skip to content

Commit

Permalink
feat: dataraptor assessment
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhinavKumar-sf committed Nov 8, 2024
1 parent 72c9cc9 commit fac96f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/utils/formula/formulaUtil.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/* eslint-disable camelcase */
import { expect } from '@salesforce/command/lib/test';
import { AnyJson } from '@salesforce/ts-types';
import { getReplacedString } from '../../../src/utils/formula/FormulaUtil';
import { getReplacedString, populateRegexForFunctionMetadata } from '../../../src/utils/formula/FormulaUtil';

describe('ApexASTParser', () => {
describe('FormulaUtilTest', () => {
it('should generate new string with standard function format', () => {
const namespacePrefix = 'test_namespace__';
const mockedFunctionDefinitionMetadata = getMockedAllFunctionMetadata();
populateRegexForFunctionMetadata(mockedFunctionDefinitionMetadata);
const inputString = "TESTMETHODFIRST('hello','bye')";
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const result = getReplacedString(namespacePrefix, inputString, mockedFunctionDefinitionMetadata);
Expand All @@ -18,6 +19,7 @@ describe('ApexASTParser', () => {
it('should generate new string with standard function format with nested custom formula', () => {
const namespacePrefix = 'test_namespace__';
const mockedFunctionDefinitionMetadata = getMockedAllFunctionMetadata();
populateRegexForFunctionMetadata(mockedFunctionDefinitionMetadata);
const inputString = "TESTMETHODFIRST('hello',TESTMETHOD('bye'))";
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const result = getReplacedString(namespacePrefix, inputString, mockedFunctionDefinitionMetadata);
Expand All @@ -29,6 +31,7 @@ describe('ApexASTParser', () => {
it('should generate new string with standard function format with nested custom formula and a formula used more than Once', () => {
const namespacePrefix = 'test_namespace__';
const mockedFunctionDefinitionMetadata = getMockedAllFunctionMetadata();
populateRegexForFunctionMetadata(mockedFunctionDefinitionMetadata);
const inputString = "TESTMETHODFIRST('hello',TESTMETHOD(TESTMETHODFIRST('bye','check')))";
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
const result = getReplacedString(namespacePrefix, inputString, mockedFunctionDefinitionMetadata);
Expand Down

0 comments on commit fac96f3

Please sign in to comment.