Skip to content

Commit 9b74e8d

Browse files
fix(rbac): clean up
Signed-off-by: Oleksandr Andriienko <[email protected]>
1 parent cf91f42 commit 9b74e8d

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

plugins/rbac-backend/src/service/policies-rest-api.test.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ describe('REST policies api', () => {
319319
jest.clearAllMocks();
320320
});
321321

322-
it('should build', async () => {
322+
it('should build', () => {
323323
expect(app).toBeTruthy();
324324
});
325325

@@ -558,7 +558,6 @@ describe('REST policies api', () => {
558558
mockedAuthorizeConditional.mockImplementationOnce(async () => [
559559
{ result: AuthorizeResult.DENY },
560560
]);
561-
562561
const result = await request(app)
563562
.get('/policies/user/default/permission_admin')
564563
.send();
@@ -1192,7 +1191,6 @@ describe('REST policies api', () => {
11921191
.mockImplementation(async (..._param: string[]): Promise<boolean> => {
11931192
return true;
11941193
});
1195-
11961194
const result = await request(app)
11971195
.put('/policies/user/default/permission_admin')
11981196
.send({
@@ -2479,30 +2477,29 @@ describe('REST policies api', () => {
24792477
});
24802478

24812479
describe('GetFirstQuery', () => {
2482-
it('should return an empty string for undefined query value', async () => {
2480+
it('should return an empty string for undefined query value', () => {
24832481
const result = server.getFirstQuery(undefined);
24842482
expect(result).toBe('');
24852483
});
24862484

24872485
it('should return the first string value from a string array', async () => {
24882486
const queryValue = ['value1', 'value2'];
2489-
24902487
const result = server.getFirstQuery(queryValue);
24912488
expect(result).toBe('value1');
24922489
});
24932490

2494-
it('should throw an InputError for an array of ParsedQs', async () => {
2491+
it('should throw an InputError for an array of ParsedQs', () => {
24952492
const queryValue = [{ key: 'value' }, { key: 'value2' }];
24962493
expect(() => server.getFirstQuery(queryValue)).toThrow(InputError);
24972494
});
24982495

2499-
it('should return the string value when query value is a string', async () => {
2496+
it('should return the string value when query value is a string', () => {
25002497
const queryValue = 'singleValue';
25012498
const result = server.getFirstQuery(queryValue);
25022499
expect(result).toBe('singleValue');
25032500
});
25042501

2505-
it('should throw an InputError for ParsedQs', async () => {
2502+
it('should throw an InputError for ParsedQs', () => {
25062503
const queryValue = { key: 'value' };
25072504
expect(() => server.getFirstQuery(queryValue)).toThrow(InputError);
25082505
});
@@ -2580,7 +2577,6 @@ describe('REST policies api', () => {
25802577
return [];
25812578
},
25822579
);
2583-
25842580
const result = await request(app)
25852581
.get('/roles/conditions?pluginId=catalog')
25862582
.send();
@@ -2603,7 +2599,6 @@ describe('REST policies api', () => {
26032599
return [];
26042600
},
26052601
);
2606-
26072602
const result = await request(app)
26082603
.get('/roles/conditions?pluginId=scaffolder')
26092604
.send();
@@ -2626,7 +2621,6 @@ describe('REST policies api', () => {
26262621
return [];
26272622
},
26282623
);
2629-
26302624
const result = await request(app)
26312625
.get('/roles/conditions?resourceType=catalog-entity')
26322626
.send();
@@ -2803,7 +2797,6 @@ describe('REST policies api', () => {
28032797
params: { claims: ['group:default/team-a'] },
28042798
},
28052799
};
2806-
28072800
const result = await request(app)
28082801
.post('/roles/conditions')
28092802
.send(roleCondition);
@@ -2865,7 +2858,6 @@ describe('REST policies api', () => {
28652858
params: { claims: ['group:default/team-a'] },
28662859
},
28672860
};
2868-
28692861
const result = await request(app)
28702862
.put('/roles/conditions/1')
28712863
.send(conditionDecision);
@@ -2917,7 +2909,6 @@ describe('REST policies api', () => {
29172909
.mockImplementation(async () => {
29182910
return pluginMetadata;
29192911
});
2920-
29212912
const result = await request(app).get('/plugins/policies').send();
29222913
expect(result.statusCode).toEqual(200);
29232914
expect(result.body).toEqual(pluginMetadata);
@@ -2927,7 +2918,6 @@ describe('REST policies api', () => {
29272918
mockedAuthorizeConditional.mockImplementationOnce(async () => [
29282919
{ result: AuthorizeResult.DENY },
29292920
]);
2930-
29312921
const result = await request(app).get('/plugins/policies').send();
29322922

29332923
expect(mockedAuthorizeConditional).toHaveBeenCalledWith(
@@ -2971,7 +2961,6 @@ describe('REST policies api', () => {
29712961
.mockImplementation(async () => {
29722962
return rules;
29732963
});
2974-
29752964
const result = await request(app).get('/plugins/condition-rules').send();
29762965
expect(result.statusCode).toEqual(200);
29772966
expect(result.body).toEqual(rules);
@@ -2981,7 +2970,6 @@ describe('REST policies api', () => {
29812970
mockedAuthorizeConditional.mockImplementationOnce(async () => [
29822971
{ result: AuthorizeResult.DENY },
29832972
]);
2984-
29852973
const result = await request(app).get('/plugins/condition-rules').send();
29862974

29872975
expect(mockedAuthorizeConditional).toHaveBeenCalledWith(

0 commit comments

Comments
 (0)