This repository was archived by the owner on Apr 10, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Expand file tree Collapse file tree 3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change 66 * @returns {N/url }
77 */
88
9+ const record = require ( './record' ) ;
10+
11+ const transactionPath = Object . freeze ( {
12+ [ record . Type . PURCHASE_ORDER ] : 'purchord' ,
13+ [ record . Type . SALES_ORDER ] : 'salesord' ,
14+ } ) ;
15+
916module . exports = {
10- resolveScript : obj => `https://system.eu2.netsuite.com/app/site/hosting/scriptlet.nl?script=${ obj . scriptId } &deploy=${ obj . deploymentId } ` ,
11- resolveRecord : ( ) => 'https://system.eu2.netsuite.com//app/accounting/transactions/salesord.nl' ,
17+ HostType : {
18+ APPLICATION : 'APPLICATION' ,
19+ CUSTOMER_CENTER : 'CUSTOMER_CENTER' ,
20+ FORM : 'FORM' ,
21+ RESTLET : 'RESTLET' ,
22+ SUITETALK : 'SUITETALK' ,
23+ } ,
24+ resolveDomain : ( ) => 'system.eu2.netsuite.com' ,
25+ resolveRecord : ( { recordType, recordId } ) => `/app/accounting/transactions/${ transactionPath [ recordType ] } .nl?id=${ recordId } ` ,
26+ resolveScript : ( { scriptId, deploymentId } ) => `https://system.eu2.netsuite.com/app/site/hosting/scriptlet.nl?script=${ scriptId } &deploy=${ deploymentId } ` ,
1227} ;
Original file line number Diff line number Diff line change 33 *
44 */
55
6- const fileUnderTest = require ( '../../N/url' ) ;
6+ const record = require ( '../../N/record' ) ;
7+ const url = require ( '../../N/url' ) ;
78
89describe ( 'Testing url module' , ( ) => {
910 it ( 'Should return object with properies available in Netsuite\'s url module ' , ( ) => {
1011 const expected = {
12+ resolveDomain : expect . any ( Function ) ,
1113 resolveScript : expect . any ( Function ) ,
1214 resolveRecord : expect . any ( Function ) ,
1315 } ;
14- expect ( fileUnderTest ) . toMatchObject ( expected ) ;
16+
17+ expect ( url ) . toMatchObject ( expected ) ;
18+ } ) ;
19+
20+ it ( 'Should return transaction url' , ( ) => {
21+ const result = url . resolveRecord ( { recordType : record . Type . SALES_ORDER , recordId : 1234567 } ) ;
22+
23+ expect ( result ) . toBe ( '/app/accounting/transactions/salesord.nl?id=1234567' ) ;
1524 } ) ;
1625} ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " ns-suitescript-mocks" ,
3- "version" : " 0.2.6 " ,
3+ "version" : " 0.2.7 " ,
44 "description" : " Collection of mocks that can be used to improve unit-tests for SuiteScript 2.0." ,
55 "main" : " index.js" ,
66 "author" : " Damian Krolikowski" ,
5151 "collectCoverage" : true ,
5252 "testURL" : " http://localhost"
5353 }
54- }
54+ }
You can’t perform that action at this time.
0 commit comments