-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π pull request #8 from devnetkc/addTests
β Tests stubs ensuring that they work
- Loading branch information
Showing
24 changed files
with
17,635 additions
and
1,497 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
113
docs/-__tests___stubs_SuiteScripts_Modules_aModule-test.js.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
104
docs/-__tests___stubs_SuiteScripts_Modules_bModule-test.js.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.