mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
AAE-30882 - Fixed unit test for js-api
This commit is contained in:
@@ -20,7 +20,19 @@ import { BaseMock } from '../base.mock';
|
||||
|
||||
export class UploadMock extends BaseMock {
|
||||
get201CreationFile(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
nock(this.host).persist().options(/.*/).reply(200, '', {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET,PUT,POST,DELETE,OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type, Authorization, Content-Length, X-Requested-With',
|
||||
'Access-Control-Allow-Credentials': 'true'
|
||||
});
|
||||
|
||||
// Handle POST request with any query parameters
|
||||
nock(this.host)
|
||||
.defaultReplyHeaders({
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Credentials': 'true'
|
||||
})
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
|
||||
.reply(201, {
|
||||
entry: {
|
||||
@@ -47,7 +59,7 @@ export class UploadMock extends BaseMock {
|
||||
}
|
||||
|
||||
get201CreationFileAutoRename(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
|
||||
.query({ autoRename: 'true' })
|
||||
.reply(201, {
|
||||
@@ -75,7 +87,7 @@ export class UploadMock extends BaseMock {
|
||||
}
|
||||
|
||||
get409CreationFileNewNameClashes(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
|
||||
.reply(409, {
|
||||
error: {
|
||||
@@ -89,7 +101,7 @@ export class UploadMock extends BaseMock {
|
||||
}
|
||||
|
||||
get401Response(): void {
|
||||
nock(this.host, { encodedQueryParams: true })
|
||||
this.createNockWithCors()
|
||||
.post('/alfresco/api/-default-/public/alfresco/versions/1/nodes/-root-/children')
|
||||
.reply(401, {
|
||||
error: {
|
||||
|
Reference in New Issue
Block a user