Skip to content

Commit

Permalink
πŸ”€ pull request #8 from devnetkc/addTests
Browse files Browse the repository at this point in the history
βœ… Tests stubs ensuring that they work
  • Loading branch information
devnetkc authored Nov 27, 2022
2 parents 87a10ff + f7ea0c2 commit be54885
Show file tree
Hide file tree
Showing 24 changed files with 17,635 additions and 1,497 deletions.
12 changes: 12 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
__tests__
node_modules
wiki
docs
.ci
.github
.vscode
.jshintrc
.npmrc
.prettierignore
.prettierrc.json
jest.config.js
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ Azure yaml pipeline files are provided in [`.ci/workflows`](./.ci/workflows).

- [`azure-pipelines-docs.yml`](./.ci/workflows/azure-pipelines-docs.yml) -- Generates documentation, commits,and pushes back to current PR/branch

## πŸ‘₯ Contributors

| Name | GitHub | Twitter |
| ------------------ | --------------------------------------- | ----------------------------------------- |
| **Ryan Valizan** | [devnetkc](https://github.com/devnetkc) | [@devnetkc](https://twitter.com/devnetkc) |
| **GitHub Actions** | [actions](https://github.com/actions) | [@](https://twitter.com/) |

## Modules

Expand Down
62 changes: 62 additions & 0 deletions __tests__/stubs/SuiteScripts/Modules/aModule-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* @format
* @module customModule_CS-test
*/

import log from 'N/log';
import query from 'N/query';
import aModule from '/SuiteScripts/Modules/aModule';
import aModuleMin from '/SuiteScripts/Modules/aModule.min';

jest.mock('N/log');
jest.mock('N/query');

beforeEach(() => {
jest.clearAllMocks();
});
// eslint-disable-next-line import/no-amd
describe('aModule.js Stub Tests', () => {
// * GIVEN
const VendorId = '1234';
describe('GetVendorPrefix method should ', () => {
test('Return undefined without errors', () => {
// * WHEN
const VendorPrefix = aModule.GetVendorPrefix(VendorId);
// * THEN
expect(VendorPrefix).toBeUndefined();
expect(jest.fn(() => VendorPrefix)).not.toThrow(Error);
});
});
describe('RunQuery method should', () => {
test('Return empty object without errors', () => {
// * WHEN
const QueryResult = aModule.RunQuery(VendorId);
// * THEN
expect(QueryResult).toBeUndefined();
expect(jest.fn(() => QueryResult)).not.toThrow(Error);
});
});
});
// * GIVEN
describe('aModule.min.js Stub Tests', () => {
// * GIVEN
const VendorId = '4321';
describe('GetVendorPrefix method should ', () => {
test('Return undefined without errors', () => {
// * WHEN
const VendorPrefix = aModuleMin.GetVendorPrefix(VendorId);
// * THEN
expect(VendorPrefix).toBeUndefined();
expect(jest.fn(() => VendorPrefix)).not.toThrow(Error);
});
});
describe('GetVendorPrefix method should ', () => {
test('Return undefined without errors', () => {
// * WHEN
const VendorPrefix = aModuleMin.GetVendorPrefix(VendorId);
// * THEN
expect(VendorPrefix).toBeUndefined();
expect(jest.fn(() => VendorPrefix)).not.toThrow(Error);
});
});
});
53 changes: 53 additions & 0 deletions __tests__/stubs/SuiteScripts/Modules/bModule-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* @format
* @module customModule_CS-test
*/

import log from 'N/log';
import record from 'N/record';
import bModule from '/SuiteScripts/Modules/bModule';
import bModuleMin from '/SuiteScripts/Modules/bModule.min';

jest.mock('N/log');
jest.mock('N/record');

beforeEach(() => {
jest.clearAllMocks();
});
// eslint-disable-next-line import/no-amd
describe('bModule.js Stub Tests', () => {
describe('set_CustomFieldValue method should ', () => {
// * GIVEN
const Record = new record.Record();
const Options = {
fieldId: 'custbody_example-id-1',
currentRecord: Record,
value: '1234',
};
test('Return undefined without errors', () => {
// * WHEN
const ValueSet = bModule.set_CustomFieldValue(Options);
// * THEN
expect(ValueSet).toBeUndefined();
expect(jest.fn(() => ValueSet)).not.toThrow(Error);
});
});
});
describe('bModule.min.js Stub Tests', () => {
describe('set_CustomFieldValue method should ', () => {
// * GIVEN
const Record = new record.Record();
const Options = {
fieldId: 'custbody_example-id-1',
currentRecord: Record,
value: '1234',
};
test('Return undefined without errors', () => {
// * WHEN
const ValueSet = bModuleMin.set_CustomFieldValue(Options);
// * THEN
expect(ValueSet).toBeUndefined();
expect(jest.fn(() => ValueSet)).not.toThrow(Error);
});
});
});
113 changes: 113 additions & 0 deletions docs/-__tests___stubs_SuiteScripts_Modules_aModule-test.js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: __tests__/stubs/SuiteScripts/Modules/aModule-test.js</title>

<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

<h1 class="page-title">Source: __tests__/stubs/SuiteScripts/Modules/aModule-test.js</h1>






<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* @format
* @module customModule_CS-test
*/

import log from 'N/log';
import query from 'N/query';
import aModule from '/SuiteScripts/Modules/aModule';
import aModuleMin from '/SuiteScripts/Modules/aModule.min';

jest.mock('N/log');
jest.mock('N/query');

beforeEach(() => {
jest.clearAllMocks();
});
// eslint-disable-next-line import/no-amd
describe('aModule.js Stub Tests', () => {
// * GIVEN
const VendorId = '1234';
describe('GetVendorPrefix method should ', () => {
test('Return undefined without errors', () => {
// * WHEN
const VendorPrefix = aModule.GetVendorPrefix(VendorId);
// * THEN
expect(VendorPrefix).toBeUndefined();
expect(jest.fn(() => VendorPrefix)).not.toThrow(Error);
});
});
describe('RunQuery method should', () => {
test('Return empty object without errors', () => {
// * WHEN
const QueryResult = aModule.RunQuery(VendorId);
// * THEN
expect(QueryResult).toBeUndefined();
expect(jest.fn(() => QueryResult)).not.toThrow(Error);
});
});
});
// * GIVEN
describe('aModule.min.js Stub Tests', () => {
// * GIVEN
const VendorId = '4321';
describe('GetVendorPrefix method should ', () => {
test('Return undefined without errors', () => {
// * WHEN
const VendorPrefix = aModuleMin.GetVendorPrefix(VendorId);
// * THEN
expect(VendorPrefix).toBeUndefined();
expect(jest.fn(() => VendorPrefix)).not.toThrow(Error);
});
});
describe('GetVendorPrefix method should ', () => {
test('Return undefined without errors', () => {
// * WHEN
const VendorPrefix = aModuleMin.GetVendorPrefix(VendorId);
// * THEN
expect(VendorPrefix).toBeUndefined();
expect(jest.fn(() => VendorPrefix)).not.toThrow(Error);
});
});
});
</code></pre>
</article>
</section>




</div>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-aModule.html">aModule</a></li><li><a href="module-bModule.html">bModule</a></li><li><a href="module-CustomJestStubs.html">CustomJestStubs</a></li><li><a href="module-customModule_CS-test.html">customModule_CS-test</a></li><li><a href="module-JestConfig.html">JestConfig</a></li></ul>
</nav>

<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Nov 27 2022 23:05:01 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
104 changes: 104 additions & 0 deletions docs/-__tests___stubs_SuiteScripts_Modules_bModule-test.js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: __tests__/stubs/SuiteScripts/Modules/bModule-test.js</title>

<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>

<body>

<div id="main">

<h1 class="page-title">Source: __tests__/stubs/SuiteScripts/Modules/bModule-test.js</h1>






<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* @format
* @module customModule_CS-test
*/

import log from 'N/log';
import record from 'N/record';
import bModule from '/SuiteScripts/Modules/bModule';
import bModuleMin from '/SuiteScripts/Modules/bModule.min';

jest.mock('N/log');
jest.mock('N/record');

beforeEach(() => {
jest.clearAllMocks();
});
// eslint-disable-next-line import/no-amd
describe('bModule.js Stub Tests', () => {
describe('set_CustomFieldValue method should ', () => {
// * GIVEN
const Record = new record.Record();
const Options = {
fieldId: 'custbody_example-id-1',
currentRecord: Record,
value: '1234',
};
test('Return undefined without errors', () => {
// * WHEN
const ValueSet = bModule.set_CustomFieldValue(Options);
// * THEN
expect(ValueSet).toBeUndefined();
expect(jest.fn(() => ValueSet)).not.toThrow(Error);
});
});
});
describe('bModule.min.js Stub Tests', () => {
describe('set_CustomFieldValue method should ', () => {
// * GIVEN
const Record = new record.Record();
const Options = {
fieldId: 'custbody_example-id-1',
currentRecord: Record,
value: '1234',
};
test('Return undefined without errors', () => {
// * WHEN
const ValueSet = bModuleMin.set_CustomFieldValue(Options);
// * THEN
expect(ValueSet).toBeUndefined();
expect(jest.fn(() => ValueSet)).not.toThrow(Error);
});
});
});
</code></pre>
</article>
</section>




</div>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-aModule.html">aModule</a></li><li><a href="module-bModule.html">bModule</a></li><li><a href="module-CustomJestStubs.html">CustomJestStubs</a></li><li><a href="module-customModule_CS-test.html">customModule_CS-test</a></li><li><a href="module-JestConfig.html">JestConfig</a></li></ul>
</nav>

<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Nov 27 2022 23:05:01 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
4 changes: 2 additions & 2 deletions docs/customJestStubs.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ <h1 class="page-title">Source: customJestStubs.js</h1>
</div>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-aModule.html">aModule</a></li><li><a href="module-bModule.html">bModule</a></li><li><a href="module-CustomJestStubs.html">CustomJestStubs</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-aModule.html">aModule</a></li><li><a href="module-bModule.html">bModule</a></li><li><a href="module-CustomJestStubs.html">CustomJestStubs</a></li><li><a href="module-customModule_CS-test.html">customModule_CS-test</a></li><li><a href="module-JestConfig.html">JestConfig</a></li></ul>
</nav>

<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Nov 27 2022 15:17:18 GMT-0600 (Central Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Nov 27 2022 23:05:01 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ <h3> </h3>
</div>

<nav>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-aModule.html">aModule</a></li><li><a href="module-bModule.html">bModule</a></li><li><a href="module-CustomJestStubs.html">CustomJestStubs</a></li></ul>
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-aModule.html">aModule</a></li><li><a href="module-bModule.html">bModule</a></li><li><a href="module-CustomJestStubs.html">CustomJestStubs</a></li><li><a href="module-customModule_CS-test.html">customModule_CS-test</a></li><li><a href="module-JestConfig.html">JestConfig</a></li></ul>
</nav>

<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Nov 27 2022 15:17:18 GMT-0600 (Central Standard Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Nov 27 2022 23:05:01 GMT+0000 (Coordinated Universal Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
Loading

0 comments on commit be54885

Please sign in to comment.