Skip to content

Commit 744d918

Browse files
committed
refactor: modified the location of sample data
1 parent 5bb504b commit 744d918

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

test/CheckSensitive.test.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('Sensitive Data Detection', () => {
2626
const step = new Step('diff');
2727

2828
// Create diff content simulating sensitive data in CSV
29-
step.setContent(createDiffContent(['test/test_data/sensitive_data.csv']));
29+
step.setContent(createDiffContent(['test/test_data/sensitveDatalikecsv/sensitive_data.csv']));
3030
action.addStep(step)
3131

3232
await exec(null, action);
@@ -36,18 +36,18 @@ describe('Sensitive Data Detection', () => {
3636
it('should detect sensitive data in XLSX file and block execution', async () => {
3737
const action = new Action('action_id', 'push', 'create', Date.now(), 'owner/repo');
3838
const step = new Step('diff');
39-
step.setContent(createDiffContent(['test/test_data/sensitive_data2.xlsx']));
39+
step.setContent(createDiffContent(['test/test_data/sensitveDatalikecsv/sensitive_data2.xlsx']));
4040
action.addStep(step);
4141

4242
await exec(null, action);
4343
sinon.assert.calledWith(logStub, sinon.match(/Your push has been blocked due to sensitive data detection/));
4444
});
4545

4646
it('should detect sensitive data in a log file and block execution', async () => {
47-
47+
// need to create the sample data
4848
const action = new Action('action_id', 'push', 'create', Date.now(), 'owner/repo');
4949
const step = new Step('diff');
50-
step.setContent(createDiffContent(['test/test_data/sensitive_data3.log']));
50+
step.setContent(createDiffContent(['test/test_data/sensitveDatalikecsv/sensitive_data3.log']));
5151
action.addStep(step);
5252
await exec(null, action);
5353
sinon.assert.calledWith(logStub, sinon.match(/Your push has been blocked due to sensitive data detection/));
@@ -58,29 +58,31 @@ describe('Sensitive Data Detection', () => {
5858

5959
const action = new Action('action_id', 'push', 'create', Date.now(), 'owner/repo');
6060
const step = new Step('diff');
61-
step.setContent(createDiffContent(['test/test_data/sensitive_data4.json']));
61+
step.setContent(createDiffContent(['test/test_data/sensitveDatalikecsv/sensitive_data4.json']));
6262
action.addStep(step);
6363
await exec(null, action);
6464
sinon.assert.calledWith(logStub, sinon.match(/Your push has been blocked due to sensitive data detection/));
6565
});
6666

6767
it('should allow execution if no sensitive data is found', async () => {
68+
// need to create sample data
6869

6970

7071
const action = new Action('action_id', 'push', 'create', Date.now(), 'owner/repo');
7172
const step = new Step('diff');
72-
step.setContent(createDiffContent(['test_data/no_sensitive_data.txt']));
73+
step.setContent(createDiffContent(['test_data/sensitveDatalikecsv/no_sensitive_data.txt']));
7374
action.addStep(step);
7475
await exec(null, action);
7576
sinon.assert.neverCalledWith(logStub, sinon.match(/Your push has been blocked due to sensitive data detection/));
7677
});
7778

7879
it('should allow execution for an empty file', async () => {
80+
// need to create sample data
7981

8082

8183
const action = new Action('action_id', 'push', 'create', Date.now(), 'owner/repo');
8284
const step = new Step('diff');
83-
step.setContent(createDiffContent(['test_data/empty_file.txt']));
85+
step.setContent(createDiffContent(['test_data/sensitveDatalikecsv/empty_file.txt']));
8486
action.addStep(step);
8587
await exec(null, action);
8688
sinon.assert.neverCalledWith(logStub, sinon.match(/Your push has been blocked due to sensitive data detection/));
@@ -90,7 +92,7 @@ describe('Sensitive Data Detection', () => {
9092

9193
const action = new Action('action_id', 'push', 'create', Date.now(), 'owner/repo');
9294
const step = new Step('diff');
93-
step.setContent(createDiffContent(['test_data/non_existent_file.txt']));
95+
step.setContent(createDiffContent(['test_data/sensitveDatalikecsv/non_existent_file.txt']));
9496
action.addStep(step);
9597
try {
9698
await exec(null, action);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)