@@ -28,6 +28,30 @@ const testResourcePath = 'system-test/resources';
28
28
29
29
test . before ( tools . checkCredentials ) ;
30
30
31
+ test ( `should redact a single sensitive data type from a string` , async t => {
32
+ const output = await tools . runAsync (
33
+ `${ cmd } string "My email is [email protected] " -t EMAIL_ADDRESS` ,
34
+ cwd
35
+ ) ;
36
+ t . regex ( output , / M y e m a i l i s \[ E M A I L _ A D D R E S S \] / ) ;
37
+ } ) ;
38
+
39
+ test ( `should redact multiple sensitive data types from a string` , async t => {
40
+ const output = await tools . runAsync (
41
+ `${ cmd } string "I am 29 years old and my email is [email protected] " -t EMAIL_ADDRESS AGE` ,
42
+ cwd
43
+ ) ;
44
+ t . regex ( output , / I a m \[ A G E \] a n d m y e m a i l i s \[ E M A I L _ A D D R E S S \] / ) ;
45
+ } ) ;
46
+
47
+ test ( `should handle string with no sensitive data` , async t => {
48
+ const output = await tools . runAsync (
49
+ `${ cmd } string "No sensitive data to redact here" -t EMAIL_ADDRESS AGE` ,
50
+ cwd
51
+ ) ;
52
+ t . regex ( output , / N o s e n s i t i v e d a t a t o r e d a c t h e r e / ) ;
53
+ } ) ;
54
+
31
55
// redact_image
32
56
test ( `should redact a single sensitive data type from an image` , async t => {
33
57
const testName = `redact-single-type` ;
@@ -61,6 +85,14 @@ test(`should redact multiple sensitive data types from an image`, async t => {
61
85
t . deepEqual ( correct , result ) ;
62
86
} ) ;
63
87
88
+ test ( `should report info type errors` , async t => {
89
+ const output = await tools . runAsync (
90
+ `${ cmd } string "My email is [email protected] " -t NONEXISTENT` ,
91
+ cwd
92
+ ) ;
93
+ t . regex ( output , / E r r o r i n d e i d e n t i f y C o n t e n t / ) ;
94
+ } ) ;
95
+
64
96
test ( `should report image redaction handling errors` , async t => {
65
97
const output = await tools . runAsync (
66
98
`${ cmd } image ${ testImage } nonexistent.result.png -t BAD_TYPE` ,
0 commit comments