Skip to content

Commit 877ec8c

Browse files
authored
Merge pull request #57 from oracle-samples/suiteworld2024
adding third-party-tools
2 parents dd26347 + d5a9ef8 commit 877ec8c

File tree

22 files changed

+7617
-0
lines changed

22 files changed

+7617
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# SuiteWorld 2024 Third Party Tools
2+
3+
4+
## Prerequisites
5+
* You will need access to a NetSuite account that can be used with test data, such as a NetSuite sandbox account or trial/demo/training account.
6+
* You will need one of the following tools from the SuiteCloud Developer Toolkit:
7+
* [SuiteCloud Extension for Visual Studio Code](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/article_159223155621.html)
8+
* [SuiteCloud Plug-in for Webstorm](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_1529431804.html)
9+
* [SuiteCloud Node CLI](https://github.com/oracle/netsuite-suitecloud-sdk)
10+
* [SuiteCloud Java CLI](https://github.com/oracle/netsuite-suitecloud-sdk)
11+
* Existing knowledge of NetSuite, SuiteScript, and the SuiteCloud Development Framwork is helpful but not required.
12+
13+
## Installation
14+
15+
In the root folder run:
16+
17+
```
18+
npm install
19+
```
20+
21+
22+
After that, you can check the output under FileCabinet folder.
23+
24+
## Jest TS support
25+
Configuration is specified in `jest.config.js` via `preset = "ts-jest"`.
26+
27+
Sample TS test is located under `src\Typescripts\__tests__` folder.
28+
29+
## SuiteScript custom stubs
30+
Custom stub implementation is located under `customStubs` folder. Configuration is specified in `jest.config.js` via `customStubs` options.
31+
32+
## Rollup
33+
Configuration is specified in `rollup.config.mjs` file.
34+
35+
We can run (see `package.json`):
36+
```
37+
npm run build
38+
```
39+
SuiteScript located under `src\Typescripts\com.netsuite.playground` folder will be transpiled first from TS to JS, using Typescript compiler, and bundled applying configuration specified in `rollup.config.mjs`.
40+
- Transform them from ESM to AMD.
41+
- Add banner.
42+
- Minify.
43+
44+
45+
## License
46+
Copyright (c) 2023 Oracle and/or its affiliates The Universal Permissive License (UPL), Version 1.0.
47+
48+
Released under the Universal Permissive License v1.0 as shown at
49+
<https://oss.oracle.com/licenses/upl/>.
50+
51+
## Disclaimer
52+
53+
The sample code included herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations. Oracle + NetSuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Oracle + NetSuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto. Oracle + NetSuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
define([], function() {
2+
/**
3+
* @namespace http
4+
*/
5+
var http = function() {};
6+
7+
/**
8+
* Send a HTTP GET request and return a reponse from a server.
9+
*
10+
* @governance 10 units
11+
* @restriction Server SuiteScript only
12+
*
13+
* @param {Object} options
14+
* @param {string} options.url the HTTP URL being requested
15+
* @param {Object} options.headers (optional) The HTTP headers
16+
* @return {ClientResponse}
17+
*
18+
* @throws {SuiteScriptError} SSS_MISSING_REQD_ARGUMENT if a required argument is missing
19+
* @throws {SuiteScriptError} SSS_INVALID_URL if an incorrect protocol is used (ex: http in the HTTPS module)
20+
*
21+
* @since 2015.2
22+
*/
23+
http.prototype.get = function(options) {};
24+
25+
/**
26+
* @exports N/http
27+
* @namespace http
28+
*/
29+
return new http();
30+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
const SuiteCloudJestConfiguration = require("@oracle/suitecloud-unit-testing/jest-configuration/SuiteCloudJestConfiguration");
2+
const cliConfig = require("./suitecloud.config");
3+
4+
const defaultSuiteCloudConfig = SuiteCloudJestConfiguration.build({
5+
projectFolder: cliConfig.defaultProjectFolder,
6+
projectType: SuiteCloudJestConfiguration.ProjectType.SUITEAPP,
7+
customStubs: [
8+
{
9+
module: "N/http",
10+
path: "<rootDir>/customStubs/http.js",
11+
},
12+
],
13+
});
14+
15+
// Adding Typescript support to your tests.
16+
defaultSuiteCloudConfig.preset = "ts-jest";
17+
18+
module.exports = defaultSuiteCloudConfig;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"typeAcquisition": {
3+
"include": ["jest"]
4+
}
5+
}

0 commit comments

Comments
 (0)