mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
AAE-30882 - Improved some unit tests
This commit is contained in:
@@ -44,6 +44,13 @@ export class BaseMock {
|
||||
};
|
||||
}
|
||||
|
||||
getBaseHeaders(): Record<string, string> {
|
||||
return {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Credentials': 'true'
|
||||
};
|
||||
}
|
||||
|
||||
protected createNockWithCors(): nock.Scope {
|
||||
this.addCorsSupport();
|
||||
return nock(this.host, { encodedQueryParams: true }).defaultReplyHeaders(this.getDefaultHeaders());
|
||||
|
@@ -15,7 +15,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { th } from 'date-fns/locale';
|
||||
import { BaseMock } from '../base.mock';
|
||||
import nock from 'nock';
|
||||
|
||||
export class SecurityGroupApiMock extends BaseMock {
|
||||
createSecurityGroup200Response(): void {
|
||||
@@ -88,7 +90,7 @@ export class SecurityGroupApiMock extends BaseMock {
|
||||
|
||||
deleteSecurityGroup200Response(securityGroupId: string): void {
|
||||
this.createNockWithCors()
|
||||
.delete('/alfresco/api/-default-/public/alfresco/versions/1/security-groups/' + securityGroupId)
|
||||
.reply(200);
|
||||
.delete('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId)
|
||||
.reply(204);
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import nock from 'nock';
|
||||
import { BaseMock } from '../base.mock';
|
||||
|
||||
export class SecurityMarkApiMock extends BaseMock {
|
||||
@@ -108,7 +109,9 @@ export class SecurityMarkApiMock extends BaseMock {
|
||||
});
|
||||
}
|
||||
getDeleteSecurityMarkSuccessfulResponse(securityGroupId: string, securityMarkId: string): void {
|
||||
this.createNockWithCors()
|
||||
this.addCorsSupport();
|
||||
nock(this.host)
|
||||
.defaultReplyHeaders(this.getBaseHeaders())
|
||||
.delete('/alfresco/api/-default-/public/gs/versions/1/security-groups/' + securityGroupId + '/security-marks/' + securityMarkId)
|
||||
.reply(200);
|
||||
}
|
||||
|
Reference in New Issue
Block a user