This repository was archived by the owner on Apr 10, 2024. It is now read-only.
File tree 3 files changed +30
-6
lines changed
3 files changed +30
-6
lines changed Original file line number Diff line number Diff line change 6
6
* @returns {N/url }
7
7
*/
8
8
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
+
9
16
module . 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 } ` ,
12
27
} ;
Original file line number Diff line number Diff line change 3
3
*
4
4
*/
5
5
6
- const fileUnderTest = require ( '../../N/url' ) ;
6
+ const record = require ( '../../N/record' ) ;
7
+ const url = require ( '../../N/url' ) ;
7
8
8
9
describe ( 'Testing url module' , ( ) => {
9
10
it ( 'Should return object with properies available in Netsuite\'s url module ' , ( ) => {
10
11
const expected = {
12
+ resolveDomain : expect . any ( Function ) ,
11
13
resolveScript : expect . any ( Function ) ,
12
14
resolveRecord : expect . any ( Function ) ,
13
15
} ;
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' ) ;
15
24
} ) ;
16
25
} ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " ns-suitescript-mocks" ,
3
- "version" : " 0.2.6 " ,
3
+ "version" : " 0.2.7 " ,
4
4
"description" : " Collection of mocks that can be used to improve unit-tests for SuiteScript 2.0." ,
5
5
"main" : " index.js" ,
6
6
"author" : " Damian Krolikowski" ,
51
51
"collectCoverage" : true ,
52
52
"testURL" : " http://localhost"
53
53
}
54
- }
54
+ }
You can’t perform that action at this time.
0 commit comments