{"_id":"@availentdev/suitemocks","_rev":"5-61c2ac04974a619ac6dbe57d5b60c8d9","name":"@availentdev/suitemocks","dist-tags":{"latest":"0.1.5"},"versions":{"0.0.5":{"name":"@availentdev/suitemocks","version":"0.0.5","author":{"name":"Availent Systems"},"license":"ISC","_id":"@availentdev/suitemocks@0.0.5","maintainers":[{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"}],"dist":{"shasum":"ee305844119e355f0748adee8b4dc63c540967dc","tarball":"https://registry.npmjs.org/@availentdev/suitemocks/-/suitemocks-0.0.5.tgz","fileCount":9,"integrity":"sha512-pGXrFhZdNfvnNJeJ4bwMKYOQp7+TyACiN/31TvahH80y4ut6zfKvpkNnIrROLAxurYkgW8/V/Wiy3DYnmwEmEQ==","signatures":[{"sig":"MEUCIQD34n6jkYtmp/rcf1/AwS0EnW2wZxQ9xhh8EBCB8i0JmwIgWbQcQLK+lWufhdAcJ2KiVVEhYm+rXNLUQ0OCa7jC35k=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5648},"main":"index.js","gitHead":"ac5d9311ac6cb8af6b3e8c2668e3ee9aa880cc4f","scripts":{"test":"test"},"_npmUser":{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"},"_npmVersion":"9.5.0","description":"Mocks for suitescript entry point scriptContext","directories":{},"_nodeVersion":"18.14.2","dependencies":{"jest":"^29.7.0","@oracle/suitecloud-unit-testing":"^1.5.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/suitemocks_0.0.5_1711139736755_0.7978370117759361","host":"s3://npm-registry-packages"}},"0.1.0":{"name":"@availentdev/suitemocks","version":"0.1.0","author":{"name":"Availent Systems"},"license":"ISC","_id":"@availentdev/suitemocks@0.1.0","maintainers":[{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"}],"dist":{"shasum":"58d8a1c44dc162e12a01d37654f4323e95b4565d","tarball":"https://registry.npmjs.org/@availentdev/suitemocks/-/suitemocks-0.1.0.tgz","fileCount":15,"integrity":"sha512-KYkGWS345LsuoKF9jM6ayWv7jomJJMVT57uVgQ+GmPOzw1RwCOpvfsg2W+9uTFya3sDuuHnleIoL45yrLiQ7Lg==","signatures":[{"sig":"MEQCIHLXlt3Djiw6AntNC9l5uTj6N6z4OjoESbqMS1mq0KQSAiAGNd5fpKVMYOE+OvOoo2t0LMN4gQ9jHWNG05VNZ8EBmw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9572},"main":"index.js","gitHead":"b993f09d6a1d6106d79e7def86c52084050c1ae8","scripts":{"test":"test"},"_npmUser":{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"},"_npmVersion":"9.5.0","description":"Mocks for suitescript entry point scriptContext","directories":{},"_nodeVersion":"18.14.2","dependencies":{"jest":"^29.7.0","@oracle/suitecloud-unit-testing":"^1.5.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/suitemocks_0.1.0_1713215283713_0.07481724434250614","host":"s3://npm-registry-packages"}},"0.1.1":{"name":"@availentdev/suitemocks","version":"0.1.1","author":{"name":"Availent Systems"},"license":"ISC","_id":"@availentdev/suitemocks@0.1.1","maintainers":[{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"}],"dist":{"shasum":"cfe9116ebf3466aca576c94480cd51c12a5dc287","tarball":"https://registry.npmjs.org/@availentdev/suitemocks/-/suitemocks-0.1.1.tgz","fileCount":17,"integrity":"sha512-nNNV28fq8HafE16TPTd7To3LHNxRG9FQPLvWHOcMCUE8jUXWtLv5OYWpggcHIcWStJASkhfxWrbGZGL7DauwOA==","signatures":[{"sig":"MEQCIEeOhMBVvIfVpwxnRZunVQxXtUpZTF1mqAcQreOxcpXiAiAxJ6GUn741YvnC6bKrsT+GbCRUWDzimlqT55tjoe6ZHQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":16666},"main":"index.js","gitHead":"b993f09d6a1d6106d79e7def86c52084050c1ae8","scripts":{"test":"test"},"_npmUser":{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"},"_npmVersion":"9.5.0","description":"Mocks for suitescript entry point scriptContext","directories":{},"_nodeVersion":"18.14.2","dependencies":{"jest":"^29.7.0","@oracle/suitecloud-unit-testing":"^1.5.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/suitemocks_0.1.1_1713215341190_0.2581566747126227","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"@availentdev/suitemocks","version":"0.1.2","author":{"name":"Availent Systems"},"license":"ISC","_id":"@availentdev/suitemocks@0.1.2","maintainers":[{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"}],"dist":{"shasum":"c1123aa612647fabd5af88baa3fab335f34c52c3","tarball":"https://registry.npmjs.org/@availentdev/suitemocks/-/suitemocks-0.1.2.tgz","fileCount":18,"integrity":"sha512-4ZPxk75PtBNFl+E+wk8jEZUDs43y6eZuqwjxlseFKiU+y76Rof/wv6uJ6pGQI2Vz9fG3+CqSQewGaiFSvE6SCQ==","signatures":[{"sig":"MEYCIQCSjE+dVXa3rwm/VPCKCtCt+7mnMHC3HiefPh/d+bZnowIhAMqHXtuYuVwnSNTWGHBgZDWN/j03J2lbt3Apf+LmD8R3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23044},"main":"index.js","gitHead":"b59e34a77c98e5230d177ee69e24b4e9352f181a","scripts":{"test":"test"},"_npmUser":{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"},"_npmVersion":"9.5.0","description":"Mocks for suitescript entry point scriptContext","directories":{},"_nodeVersion":"18.14.2","dependencies":{"jest":"^29.7.0","@oracle/suitecloud-unit-testing":"^1.5.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/suitemocks_0.1.2_1713367914093_0.7580946357244922","host":"s3://npm-registry-packages"}},"0.1.4":{"name":"@availentdev/suitemocks","version":"0.1.4","author":{"name":"Availent Systems"},"license":"ISC","_id":"@availentdev/suitemocks@0.1.4","maintainers":[{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"}],"dist":{"shasum":"8e4ca21e161f69941dd9d851165c783436a00503","tarball":"https://registry.npmjs.org/@availentdev/suitemocks/-/suitemocks-0.1.4.tgz","fileCount":25,"integrity":"sha512-syLzWG8hd8TdgjZFJ2UbdqIwxCr96hOs/DSH33/orZimuJU6lAEDgsceEdPqd1qocimnazsszBvCXwCW1gdKRg==","signatures":[{"sig":"MEUCIEkz6UGZaE4FOfXc0fURxs1ehqIyMGw5P24feRNofFLtAiEA3clRmpWUcJGlJXZl2bFGiXHSbsfAqgEmDGBsSTVI7Po=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":27717},"main":"index.js","gitHead":"fb7f08f63936ea4ab6df820b82849101930946ff","scripts":{"test":"test"},"_npmUser":{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"},"_npmVersion":"10.5.0","description":"Mocks for suitescript entry point scriptContext","directories":{},"_nodeVersion":"20.12.1","dependencies":{"jest":"^29.7.0","@oracle/suitecloud-unit-testing":"^1.5.0"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/suitemocks_0.1.4_1722012843375_0.2510793659489807","host":"s3://npm-registry-packages"}},"0.1.5":{"name":"@availentdev/suitemocks","version":"0.1.5","description":"Mocks for suitescript entry point scriptContext","main":"index.js","scripts":{"test":"test"},"author":{"name":"Availent Systems"},"license":"ISC","dependencies":{"@oracle/suitecloud-unit-testing":"^1.5.0","jest":"^29.7.0"},"_id":"@availentdev/suitemocks@0.1.5","gitHead":"c9baeba42aed76cf04ec67d79d41328bd71637e8","_nodeVersion":"20.12.1","_npmVersion":"10.5.0","dist":{"integrity":"sha512-vpzhiOf21FYWtKZ4Un+LTXoVrRwQl00n3o9zOfA3N3BalkXbubujoGRQxbENIBENXxHSHYgtRZjBV9Hia29Ytw==","shasum":"aeac6d20aba459d302236fcb8cb0430562e31c3d","tarball":"https://registry.npmjs.org/@availentdev/suitemocks/-/suitemocks-0.1.5.tgz","fileCount":28,"unpackedSize":29683,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCJ64WoLZm3PJ3i7xuaz8cdd/YewJADAReAD8HSrBoaBQIgaes3H0lRtHpVCQ3deUjoeUoSGal5Le/0f1lJgeqHlwE="}]},"_npmUser":{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"},"directories":{},"maintainers":[{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/suitemocks_0.1.5_1726679652210_0.9142855248390946"},"_hasShrinkwrap":false}},"time":{"created":"2024-03-22T20:35:36.645Z","modified":"2024-09-18T17:14:12.606Z","0.0.5":"2024-03-22T20:35:36.909Z","0.1.0":"2024-04-15T21:08:03.955Z","0.1.1":"2024-04-15T21:09:01.327Z","0.1.2":"2024-04-17T15:31:54.229Z","0.1.4":"2024-07-26T16:54:03.518Z","0.1.5":"2024-09-18T17:14:12.422Z"},"author":{"name":"Availent Systems"},"license":"ISC","description":"Mocks for suitescript entry point scriptContext","maintainers":[{"name":"availentdev","email":"lawrence.ballenger@availentsystems.com"}],"readme":"# README #\r\n\r\n### What is this repository for? ###\r\n\r\n* This contains mocks of SuiteScript entry points for use with jest testing.\r\n* Version 0.1.5\r\n\r\n### How do I get set up? ###\r\n\r\n* You can install by running `npm install @availentdev/suitemocks --save-dev`\r\n* Before using this package\r\n  * Follow instructions for setting up your SuiteScript project for testing [here](https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/article_4110608501.html)\r\n  * Additional information can be found [here](https://github.com/oracle/netsuite-suitecloud-sdk/tree/master/packages/unit-testing)\r\n  * Test examples can be found [here](https://github.com/oracle-samples/netsuite-suitecloud-samples)\r\n* Once installed and your project is configured for testing\r\n  * Copy and paste the following over the contents of jest.config.js\r\n  * This adds the array of custom stubs, which allows custom stubs to mimic the import style of stubs provided by @oracle/suitecloud-unit-testing\r\n    * Ex. `import afterSubmitContext from 'N/ScriptContext/afterSubmitContext';`\r\n    * Rather than `./path/to/file/afterSubmitContext`\r\n  * The transformIgnorePatterns property is modified to include this package so that @babel can transform them properly alongside the stubs provided by @oracle/suitecloud-unit-testing\r\n  \r\n````javascript\r\nconst SuiteCloudJestConfiguration = require('@oracle/suitecloud-unit-testing/jest-configuration/SuiteCloudJestConfiguration');\r\nconst cliConfig = require('./suitecloud.config');\r\n\r\nconst TESTING_FRAMEWORK_PATH = '@oracle/suitecloud-unit-testing';\r\nconst CORE_STUBS_PATH = `${TESTING_FRAMEWORK_PATH}/stubs`;\r\nconst nodeModulesToTransform = [CORE_STUBS_PATH].join('|');\r\n\r\nconst build = SuiteCloudJestConfiguration.build({\r\n  projectFolder: cliConfig.defaultProjectFolder,\r\n  projectType: SuiteCloudJestConfiguration.ProjectType.ACP,\r\n  customStubs: [\r\n    {\r\n      module: 'N/ScriptContext/beforeLoadContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/UserEvent/beforeLoadContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/beforeSubmitContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/UserEvent/beforeSubmitContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/afterSubmitContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/UserEvent/afterSubmitContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/inputContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/MapReduce/inputContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/mapContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/MapReduce/mapContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/reduceContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/MapReduce/reduceContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/summaryContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/MapReduce/summaryContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/pageInitContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/pageInitContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/saveRecordContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/saveRecordContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/fieldChangedContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/fieldChangedContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/sublistChangedContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/sublistChangedContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/postSourcingContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/postSourcingContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/lineInitContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/lineInitContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/validateFieldContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/validateFieldContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/validateLineContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/validateLineContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/validateInsertContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/validateInsertContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/validateDeleteContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ClientScript/validateDeleteContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/eachParamsContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/MassUpdate/eachParamsContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/executeContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/ScheduledScript/executeContext.js',\r\n    },\r\n    {\r\n      module: 'N/ScriptContext/onRequestContext',\r\n      path: '<rootDir>/node_modules/@availentdev/suitemocks/customStubs/Suitelet/onRequestContext.js',\r\n    },\r\n  ],\r\n});\r\n\r\nbuild.transformIgnorePatterns = [`/node_modules/(?!(${nodeModulesToTransform}|@availentdev/suitemocks)/)`];\r\n\r\nmodule.exports = build;\r\n````\r\n\r\n* Each scriptContext mock contains the properties normally found in the scriptContext for that entry point\r\n  * Properties representing SuiteScript module objects are included with each of their methods as a jest function\r\n  * Properties of primitive data types default to undefined\r\n  * Enums are included\r\n  * Example for User Event afterSubmit:\r\n   \r\n   ````javascript\r\n   {\r\n    oldRecord = recordObj,\r\n    newRecord = recordObj,\r\n    type = undefined,\r\n    UserEventType = {\r\n      COPY: 'copy',\r\n      CREATE: 'create',\r\n      VIEW: 'view',\r\n      EDIT: 'edit',\r\n      XEDIT: 'xedit',\r\n      DELETE: 'delete',\r\n      DROPSHIP: 'dropship',\r\n      SPECIALORDER: 'specialorder',\r\n      ORDERITEMS: 'orderitems',\r\n      CANCEL: 'cancel',\r\n      APPROVE: 'approve',\r\n      REJECT: 'reject',\r\n      RETRACT: 'retract',\r\n      SAVESUBMIT: 'savesubmit',\r\n      PACK: 'pack',\r\n      SHIP: 'ship',\r\n      EDITFORECAST: 'editforecast',\r\n      REASSIGN: 'reassign',\r\n      MARKCOMPLETE: 'markcomplete',\r\n      PRINT: 'print',\r\n      EMAIL: 'email',\r\n      CHANGEPASSWORD: 'changepassword',\r\n      TRANSFORM: 'transform',\r\n      PAYBILLS: 'paybills',\r\n      QUICKVIEW: 'quickview',\r\n    }\r\n  }\r\n  ````\r\n  * oldRecord and newRecord in this example represent record.record objects\r\n    * Each method is a jest function\r\n      * Immediately available in tests `expect(afterSubmitScriptContextMock.getValue).toHaveBeenCalled();`\r\n      * However, any mock returns or implementations need to be set up in the test file \r\n  \r\n  \r\n\r\n### Contribution guidelines ###\r\n\r\nTo create new script contexts, copy an existing context file that most closely matches the one you need. Then, using NetSuite's documentation, add, remove, or modify the properties.\r\n\r\nEntry points not yet included:\r\n  - Bundle Installation Script:\r\n    - afterInstall(params)\r\n    - afterUpdate(params)\r\n    - beforeInstall(params)\r\n    - beforeUninstall(params)\r\n    - beforeUpdate(params)\r\n\r\n  - Client Script:\r\n    - localizationContextEnter(scriptContext)\r\n    - localizationContextExit(scriptContext)\r\n\r\n  - Portlet:\r\n    - render(params) (needs Portlet object added)\r\n\r\n  - RESTlet:\r\n    - get\r\n    - delete\r\n    - put\r\n    - post\r\n\r\n  - Workflow Action:\r\n    - onAction(scriptContext)\r\n\r\n  - SDF Installation:\r\n    - run(scriptContext)\r\n\r\n### Who do I talk to? ###\r\n\r\n* Repo owner or admin\r\n* Other community or team contact","readmeFilename":"README.md"}