Also if you use jest for unit testing on SS projec...
# suitescript
m
Also if you use jest for unit testing on SS projects or not and why
s
We use jest for unit testing when appropriate. Also, with NFT you avoid a lot of cumbersome mocking because records and search results are just plain objects in NFT - so trivial to mock data inputs/outputs from functions.
m
i got lost with acronyms what do you mean by NFT? I did not understand what you meant sorry
a
@Shawn Talbert I just found this and was looking into NFT. It seems this is a wrapper for SuiteScript which can make unit testing easier, and not used just for testing. Is that correct?
s
Making unit testing easier is a distant side effect.
It's a thin wrapper and a few utilities to make SuiteScript development more idiomatic with common patterns. Most notably, it makes working with NS records simply instances of classes and collections. So most of your code looks like TypeScript 101 rather than a confusing and inconsistent custom API that NS provides out of the box.
so record fields, sublists, subrecords, and even 'sublist subrecords' are all treated uniformly in NFT - simply objects with properties and collections thereof.
a
Understood, thanks for the info
s
It's the fact that NFT surfaces these things as simple objects/collections that makes unit testing easier. Instead of extensive mocking for
getValue()
setValue()
and all the other data manipulation APIs, you can just pass in a POJO for your stand-in for a NS record instance.