@admc.com/eslintplugin-sn-test 3.9.1 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bad1Scripts/global/sys_atf_step_config.description_generator/es12.js +4 -0
- package/bad1Scripts/global/sys_atf_step_config.description_generator/nonimmedIife.js +7 -0
- package/bad1Scripts/global/sys_atf_step_config.description_generator/ootbBoilerplate.js +7 -0
- package/bad1Scripts/global/sys_atf_step_config.description_generator/scopedExpr.js +1 -0
- package/bad1Scripts/global/sys_atf_step_config.step_execution_generator/ootbBoilerplate.js +55 -0
- package/bad1Scripts/global/sys_script_email/wrongIifeParams.js +1 -1
- package/bad1Scripts/global/sysauto_script/unusedExpr.js +1 -0
- package/bad1Scripts/global/sysevent_in_email_action/ootbBoilerplate.js +4 -0
- package/bad1Scripts/scoped-es12/sysevent_in_email_action/ootbBoilerplate.js +6 -0
- package/bad2Scripts/atf_rsss_script-global/sys_variable_value/ootbBoilerplate.js +91 -0
- package/goodScripts/all/sp_widget.client_script/cleanedBoilerplate.js +0 -1
- package/goodScripts/atf_rsss_script-es12/sys_variable_value/cleanedBoilerplate.js +4 -0
- package/goodScripts/atf_rsss_script-es12/sys_variable_value/useGlobals.js +23 -0
- package/goodScripts/atf_rsss_script-global/sys_variable_value/cleanedBoilerplate.js +4 -0
- package/goodScripts/global/sys_atf_step_config.description_generator/expr.js +1 -0
- package/goodScripts/global/sys_atf_step_config.description_generator/nice.js +3 -0
- package/goodScripts/global/sys_atf_step_config.step_execution_generator/cleanedBoilerplate.js +4 -0
- package/goodScripts/global/sys_atf_step_config.step_execution_generator/nice.js +4 -0
- package/goodScripts/global/sysevent_in_email_action/cleanedBoilerplate.js +3 -0
- package/goodScripts/scoped-es12/sys_atf_step_config.step_execution_generator/nice.js +4 -0
- package/goodScripts/scoped-es12/sys_security_acl/unusedExpr.js +2 -0
- package/goodScripts/scoped-es12/sysevent_in_email_action/cleanedBoilerplate.js +4 -0
- package/goodScripts/scoped-es5/sys_transform_map/good.js +2 -2
- package/package.json +2 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
`I am ${gs.getUserName()}`;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// The inputs are a map of the variables defined in the inputs related list below.
|
|
2
|
+
// Inputs are consumed in the step configuration. Input
|
|
3
|
+
// values may be hardcoded or mapped from the outputs of a previous step.
|
|
4
|
+
// If a test author using your step uses mapping to pass in an output from a previous
|
|
5
|
+
// test step then when referencing the input variable the mapping will be resolved
|
|
6
|
+
// automatically
|
|
7
|
+
// Example:
|
|
8
|
+
// var myRecords = new GlideRecord(inputs.table);
|
|
9
|
+
//
|
|
10
|
+
// The outputs are a map of the variables defined in the outputs related list.
|
|
11
|
+
// Outputs should be set (assigned) in order to pass data out of a test step that
|
|
12
|
+
// can be consumed my mapping as an input to subsequent steps.
|
|
13
|
+
// Example:
|
|
14
|
+
// outputs.table = gr.getRecordClassName()
|
|
15
|
+
//
|
|
16
|
+
//
|
|
17
|
+
// Note that inputs and outputs are strongly typed as defined in their variable definition.
|
|
18
|
+
// Their behavior is the same as a dictionary defined field of the same type in a table.
|
|
19
|
+
//
|
|
20
|
+
// The stepResult is a simple API for controlling the step pass/fail and logging with three
|
|
21
|
+
// methods:
|
|
22
|
+
// stepResult.setFailed: Causes step to fail
|
|
23
|
+
//
|
|
24
|
+
// stepResult.setSuccess: Causes step to succeed
|
|
25
|
+
//
|
|
26
|
+
// stepResult.setOutputMessage: Log a message to step results after step executes.
|
|
27
|
+
// Can only be called once or will overwrite previous
|
|
28
|
+
// message
|
|
29
|
+
//
|
|
30
|
+
// If neither setFailed or setSuccess is called the default is to succeed.
|
|
31
|
+
//
|
|
32
|
+
// Example usage of step timeout in script
|
|
33
|
+
// var counter = 0;
|
|
34
|
+
// // 'timeout' is a field on the step form
|
|
35
|
+
// while (counter <= timeout) {
|
|
36
|
+
// if (desiredOutcome) {
|
|
37
|
+
// stepResult.setOutputMessage('Success!');
|
|
38
|
+
// stepResult.setSuccess();
|
|
39
|
+
// return;
|
|
40
|
+
// }
|
|
41
|
+
// counter++;
|
|
42
|
+
//
|
|
43
|
+
// // When writing scripts in ATF, use waitOneSecond() instead of gs.sleep()
|
|
44
|
+
// // since gs.sleep() may not work in non-global scopes
|
|
45
|
+
// sn_atf.AutomatedTestingFramework.waitOneSecond();
|
|
46
|
+
// }
|
|
47
|
+
//
|
|
48
|
+
// // desired outcome did not occur within the timeout
|
|
49
|
+
// stepResult.setOutputMessage('Failure!');
|
|
50
|
+
// stepResult.setFailed();
|
|
51
|
+
//
|
|
52
|
+
(function executeStep(inputs, outputs, stepResult, timeout) {
|
|
53
|
+
gs.log("Input params: " + inputs + " / " + outputs + " / " + stepResult + " / " + timeout,
|
|
54
|
+
"src");
|
|
55
|
+
}(inputs, outputs, stepResult, timeout));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
true;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
|
|
2
|
+
logger.log("Input params: " + current + " / " + event + " / " + email + " / " + classifier);
|
|
3
|
+
// Implement email action here
|
|
4
|
+
})(current, event, email, logger, classifier);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
|
|
3
|
+
|
|
4
|
+
// Implement email action here
|
|
5
|
+
logger.info(`Input params (${current}) (${event}) (${email}) (${classifier})`);
|
|
6
|
+
})(current, event, email, logger, classifier);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// You can use this step to execute a variety of server-side javascript tests including
|
|
2
|
+
// jasmine tests and custom assertions
|
|
3
|
+
//
|
|
4
|
+
//
|
|
5
|
+
// Pass or fail a step: Override the step outcome to pass or fail. This is ignored
|
|
6
|
+
// by jasmine tests
|
|
7
|
+
//
|
|
8
|
+
// - Return true from the main function body to pass the step
|
|
9
|
+
// - Return false from the main function body to fail the step
|
|
10
|
+
//
|
|
11
|
+
//
|
|
12
|
+
// outputs: Pre-defined Step config Output variables to set on this step during
|
|
13
|
+
// execution that are available to later steps
|
|
14
|
+
//
|
|
15
|
+
// steps(SYS_ID): A function to retrieve Output variable data from a step that executed
|
|
16
|
+
// earlier in the test. The desired step's sys_id is required
|
|
17
|
+
//
|
|
18
|
+
// params: The current test run data set's parameter data including both
|
|
19
|
+
// exclusive and shared parameters
|
|
20
|
+
//
|
|
21
|
+
// Example:
|
|
22
|
+
//
|
|
23
|
+
// // Test step 1 - add data
|
|
24
|
+
// var gr = new GlideRecord('sc_task');
|
|
25
|
+
// // If parameterized testing is enabled, parameters are stored in the params object
|
|
26
|
+
// gr.setValue('short_description', params.u_my_short_description)
|
|
27
|
+
// gr.setValue('caller', params.u_my_user.manager)
|
|
28
|
+
// // this sample step's Step config has Output variables named table and record_id
|
|
29
|
+
// outputs.table = 'sc_task';
|
|
30
|
+
// outputs.record_id = gr.insert();
|
|
31
|
+
//
|
|
32
|
+
// // Test step 2 - access added data and validate
|
|
33
|
+
// // check that the record exists (or that business logic changed it)
|
|
34
|
+
// var gr = new GlideRecord("sc_task");
|
|
35
|
+
// gr.get(steps(PREVIOUS_STEP_SYS_ID).record_id);
|
|
36
|
+
// assertEqual({name: "task gr exists", shouldbe: true, value: gr.isValidRecord()});
|
|
37
|
+
//
|
|
38
|
+
//
|
|
39
|
+
// stepResult.setOutputMessage: Log a message to step results after step executes.
|
|
40
|
+
// Can only be called once or will overwrite previous
|
|
41
|
+
// message
|
|
42
|
+
//
|
|
43
|
+
// Example:
|
|
44
|
+
//
|
|
45
|
+
// var gr = new GlideRecord('sc_task');
|
|
46
|
+
// gr.setValue('short_description', 'verify task can be inserted');
|
|
47
|
+
// var grSysId = gr.insert();
|
|
48
|
+
// var justCreatedGR = new GlideRecord('sc_task');
|
|
49
|
+
// if (justCreatedGR.get(grSysId)) {
|
|
50
|
+
// stepResult.setOutputMessage("Successfully inserted task record");
|
|
51
|
+
// return true; // pass the step
|
|
52
|
+
// } else {
|
|
53
|
+
// stepResult.setOutputMessage("Failed to insert task record");
|
|
54
|
+
// return false; // fail the step
|
|
55
|
+
// }
|
|
56
|
+
//
|
|
57
|
+
//
|
|
58
|
+
// Note: describe is only supported in Global scope.
|
|
59
|
+
// Use 'describe' to create a suite of test scripts and 'it' to define test expectations
|
|
60
|
+
//
|
|
61
|
+
// Example jasmine test:
|
|
62
|
+
//
|
|
63
|
+
// describe('my suite of script tests', function() {
|
|
64
|
+
// it('should meet expectations', function() {
|
|
65
|
+
// expect(true).not.toBe(false);
|
|
66
|
+
// });
|
|
67
|
+
// });
|
|
68
|
+
// // make sure to uncomment jasmine.getEnv().execute(); outside the function body
|
|
69
|
+
//
|
|
70
|
+
//
|
|
71
|
+
// assertEqual: A function used to compare that assertion.shouldbe == assertion.value;
|
|
72
|
+
// in case of failure it throws an Error and logs that the assertion by
|
|
73
|
+
// name has failed
|
|
74
|
+
//
|
|
75
|
+
// Example:
|
|
76
|
+
//
|
|
77
|
+
// var testAssertion = {
|
|
78
|
+
// name: "my test assertion",
|
|
79
|
+
// shouldbe: "expected value"
|
|
80
|
+
// value: "actual value",
|
|
81
|
+
// };
|
|
82
|
+
// assertEqual(testAssertion); // throws Error, logs message to test step output
|
|
83
|
+
//
|
|
84
|
+
(function(outputs, steps, params, stepResult, assertEqual) {
|
|
85
|
+
// add test script here
|
|
86
|
+
gs.log("Input params: " + outputs + " / " + steps + " / " + params + " / " + stepResult
|
|
87
|
+
+ " / " + assertEqual, "src");
|
|
88
|
+
|
|
89
|
+
})(outputs, steps, params, stepResult, assertEqual);
|
|
90
|
+
// uncomment the next line to execute this script as a jasmine test
|
|
91
|
+
//jasmine.getEnv().execute();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
((steps, params) => {
|
|
2
|
+
"use strict";
|
|
3
|
+
gs.info(`Provided functions:
|
|
4
|
+
${jasmine}
|
|
5
|
+
${describe}
|
|
6
|
+
${xdescribe}
|
|
7
|
+
${fdescribe}
|
|
8
|
+
${it}
|
|
9
|
+
${xit}
|
|
10
|
+
${fit}
|
|
11
|
+
${beforeEach}
|
|
12
|
+
${beforeAll}
|
|
13
|
+
${afterEach}
|
|
14
|
+
${afterAll}
|
|
15
|
+
${expect}
|
|
16
|
+
${fail}
|
|
17
|
+
${pending}
|
|
18
|
+
${spyOn}
|
|
19
|
+
+ input Params:
|
|
20
|
+
${steps}
|
|
21
|
+
${params}
|
|
22
|
+
`);
|
|
23
|
+
})(outputs, steps, params, stepResult, assertEqual);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"I am " + gs.getUserName();
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
|
|
2
|
+
logger.log("Input params: " + current + " / " + event + " / " + email + " / " + classifier);
|
|
3
|
+
})(current, event, email, logger, classifier);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
|
|
3
|
+
logger.info(`Input params (${current}) (${event}) (${email}) (${classifier})`);
|
|
4
|
+
})(current, event, email, logger, classifier);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function() {
|
|
2
|
-
gs.info("
|
|
3
|
-
})(source, target,
|
|
2
|
+
gs.info("scoped log");
|
|
3
|
+
})(source, target, map, log, action==="update");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@admc.com/eslintplugin-sn-test",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "External tests for ESLint plugin @admc.com/eslint-plugin-sn",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "mocha --recursive",
|
|
@@ -25,9 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"homepage": "https://github.com/unsaved/eslint-plugin-sn#readme",
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@admc.com/eslint-plugin-sn": "^3.13.1",
|
|
28
29
|
"mocha": "^10.0.0"
|
|
29
|
-
},
|
|
30
|
-
"peerDependencies": {
|
|
31
|
-
"@admc.com/eslint-plugin-sn": "^3.9.8"
|
|
32
30
|
}
|
|
33
31
|
}
|