-
Notifications
You must be signed in to change notification settings - Fork 1
/
myTest.js
55 lines (50 loc) · 1.73 KB
/
myTest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
A handy bit of code for working with arrays and objects
https://lodash.com/docs
*/
var _ = require("lodash");
/*
The core of dataproofer tests
https://github.com/dataproofer/dataproofertest-js
*/
var DataprooferTest = require("dataproofertest-js");
var myTest = new DataprooferTest();
/*
A set of handy utilities.
Read the fulls documentation here:
https://github.com/dataproofer/dataproofertest-js/blob/master/DOCUMENTATION.md#utilkk j
*/
var util = require("dataproofertest-js/util");
/**
* Tests contain documentation in the style of jsDoc.
* If you're new to jsDoc, use this space to describe your test.
*
* @param {Array} rows - an array of objects representing rows in the spreadsheet
* @param {Array} columnHeads - an array of strings for column names of the spreadsheet
* @return {Object} result an object describing the result
*/
myTest.name("Does spreadsheet contain rows?")
.description("Test if a spreadsheet contains more than one row.")
.conclusion("Test requires more than one row in your dataset. Please add a row of data for this test to pass.")
.methodology(function(rows, columnHeads) {
/* summary is a string describing the result of the test
* you can use HTML if you'd like to style your results
* read more about templates here:
* https://lodash.com/docs#template
* we also use multi-line strings to help with code readability
* you can use them too.
* just add opening and closing backticks ``
*/
var testState;
// passed is either "passed", "failed", "warn", or "info"
if (rows.length > 0) {
testState = "passed";
} else {
testState = "failed";
}
var result = {
testState: testState
};
return result;
});
module.exports = myTest;