3en-cloud / netsumo Goto Github PK
View Code? Open in Web Editor NEWA NetSuite mock framework, super useful for unit testing your suitescripts! (SuiteScript 1 + 2)
License: MIT License
A NetSuite mock framework, super useful for unit testing your suitescripts! (SuiteScript 1 + 2)
License: MIT License
PR #11 attempts to make getValue()
/getText()
API compatible, which raises the question if there's a need to keep the incompatible implementation (as the PR does)?
One reason to keep would be for simplicity when trying to access a value in the test (instead of passing verbose objects the API requests). I propose if there's indeed such need, to add special functions (i.e. _valueOfField('fieldName')
) so we leave functions with only a concrete, public API compatible implementation.
To maintain backwards compatibility with existing tests, removing the incompatible implementation is better done with the next major version bump.
I've come across an issue when attempting to test typescript compiled code, seems like the code produced is not compatible. Do you have any recommendations to get around this?
Works:
/**
* @NAPIVersion 2.0
* @NScriptType UserEventScript
*/
define(["require", "exports", "N/log"], function (require, exports, log) {
var beforeSubmit = function (context) {
var x = context.newRecord.getValue({fieldId: "companyname"});
log.audit("value", "companyname is: " + x);
};
return {
beforeSubmit: beforeSubmit
}
});
Fails:
/**
* @NAPIVersion 2.0
* @NScriptType UserEventScript
*/
define(["require", "exports", "N/log"], function (require, exports, log) {
Object.defineProperty(exports, "__esModule", { value: true });
//=> Object.defineProperty called on non-object (exports is undefined)
exports.beforeSubmit = function (context) {
var x = context.newRecord.getValue({ fieldId: "companyname" });
log.audit("value", "companyname is: " + x);
};
});
Specs:
tsconfig.json
The create(options)
function of the NSearch module appears to be blank and does not do anything (line 67 in modules/SS2/NSearch
).
Hi thanks for your project, the document is really useful. However, I read the example about suitelet in suitescript 1.0. would you let me know if it worked on plugin , like email capture? would you mind let me know any example for testing?
Thanks
In nsContext.js, the function nlapiSubmitRecord checks the recordsArray for a record sharing the same ID as the record being submitted. A check is not made against type.
In NS, records of different types can share the same ID.
Expected behavior: I can submit a record with type 'customrecord_foo' and ID of 1, then submit a record of type 'customrecord_bar' with an ID of 1, and the recordsArray will have a length of 2.
Will NetSumo support more NetSuite API objects in the future? For example; nlobjRequest
, nlobjResponse
and SC.Model
? These are used alot in SuiteCommerce Advanced. http://suitecoder.appspot.com/static/api.html
I'm currently at the stage of testing my SCA Services (Foo.Service.ss
files) and SCA Models (Foo.Model.js
files). I need to pass a mock nlobjRequest
to my service to test it and somehow get a mock nlobjResponse
.
If there are no immediate plans to expand the library with these objects any advice on how I can create them to contribute to this repo? :)
FYI this looks like a quite promising NetSuite testing module :) Hope it keeps getting maintained as I'm sure to share this with other NS developers.
I'm following the NetSumo 'Getting Started' and trying to run the example suitelet test in my project. However I get an error when running the test:
C:\Users\MyProject>mocha
suitelet.js
#makeNetSuiteMagic
1) Adds a line item called My Magic Item and sets the quantity to 200 passing (31ms)
1 failing
- suitelet.js #makeNetSuiteMagic Adds a line item called My Magic Item and sets the quantity to 20:
TypeError: Cannot read property 'supressNlapiLogOutput' of undefined
at nlapiLogExecution (node_modules\netsumo\modules\nsContext.js:20:13)
at Object.makeNetSuiteMagic (fileCabinet/suitelet.js:3:4)
at Context. (test\suiteletTest.js:20:17)
I editted node_modules\netsumo\modules\nsContext.js
and simply commented out the possibly undefined option supressNlapiLogOutput
and it now works.
var nlapiLogExecution = function(type,title,details) {
//if(!opts.supressNlapiLogOutput) {
console.log("TYPE: "+type+" | TITLE: "+title+" | DETAILS: "+details)
//}
}
Hi, how can we run the tests. where can we get this app. Please give me the complete info about this. can we run this in our local systems. We want to unit test NetSuite 2.0 scripts.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.