Mocking SuiteScript Properties in Unit Tests

To mock a SuiteScript property, set the value of the property to an arbitrary value in your test file. For best practice, you'll want to use a valid value type that's accepted for the SuiteScript property used. For example, the Record.type property accepts string values, so your mocked value should be a string.

          describe('Mocking SuiteScript dependencies', () => {
   it('Should mock Suitescript property', () => {
      // given
      record.create.mockReturnValue(Record);
      Record.type = 'salesorder';
   });
}); 

        

Related Topics

General Notices