Skip to content

Commit 6f605e0

Browse files
committed
Refactor OFS file property methods names
1 parent 111024a commit 6f605e0

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

src/OFS.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ export class OFS {
361361
return this._patch(partialURL, data);
362362
}
363363

364-
async getFilePropertyContent(
364+
async getActivityFilePropertyContent(
365365
aid: number,
366366
propertyLabel: string,
367367
nediaType: string = "*/*"
@@ -372,7 +372,7 @@ export class OFS {
372372
return this._get(partialURL, undefined, myHeaders);
373373
}
374374

375-
async getFilePropertyMetadata(
375+
async getActivityFilePropertyMetadata(
376376
aid: number,
377377
propertyLabel: string
378378
): Promise<OFSResponse> {
@@ -382,13 +382,16 @@ export class OFS {
382382
return this._get(partialURL, undefined, myHeaders);
383383
}
384384

385-
async getFileProperty(
385+
async getActivityFileProperty(
386386
aid: number,
387387
propertyLabel: string
388388
): Promise<OFSResponse> {
389389
var myHeaders = new Headers();
390390
const partialURL = `/rest/ofscCore/v1/activities/${aid}/${propertyLabel}`;
391-
var metadata = await this.getFilePropertyMetadata(aid, propertyLabel);
391+
var metadata = await this.getActivityFilePropertyMetadata(
392+
aid,
393+
propertyLabel
394+
);
392395
if (metadata.status < 400) {
393396
var contentType = metadata.contentType;
394397
if (contentType) {
@@ -410,7 +413,7 @@ export class OFS {
410413
}
411414
}
412415

413-
async setFileProperty(
416+
async setActivityFileProperty(
414417
aid: number,
415418
propertyLabel: string,
416419
blob: Blob,

test/general/core.activities.test.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ test("Set File Property (Text)", async () => {
108108
var fileContent = "Hello World";
109109
var contentType: string = "text/plain";
110110
var blob = new Blob([Buffer.from(fileContent)], { type: contentType });
111-
var result = await myProxy.setFileProperty(
111+
var result = await myProxy.setActivityFileProperty(
112112
aid,
113113
"ATTACHMENT",
114114
blob,
@@ -137,7 +137,7 @@ test("Get File Property (Text)", async () => {
137137
var fileContent = faker.lorem.paragraphs(5);
138138
var contentType: string = "text/plain";
139139
var blob = new Blob([Buffer.from(fileContent)], { type: contentType });
140-
var result = await myProxy.setFileProperty(
140+
var result = await myProxy.setActivityFileProperty(
141141
aid,
142142
"ATTACHMENT",
143143
blob,
@@ -150,7 +150,10 @@ test("Get File Property (Text)", async () => {
150150
console.error(result);
151151
throw error;
152152
}
153-
var result = await myProxy.getFilePropertyMetadata(aid, "ATTACHMENT");
153+
var result = await myProxy.getActivityFilePropertyMetadata(
154+
aid,
155+
"ATTACHMENT"
156+
);
154157
try {
155158
expect(result.status).toBe(200);
156159
expect(result.data.size).toBe(fileContent.length);
@@ -161,7 +164,7 @@ test("Get File Property (Text)", async () => {
161164
throw error;
162165
}
163166

164-
var result = await myProxy.getFilePropertyContent(
167+
var result = await myProxy.getActivityFilePropertyContent(
165168
aid,
166169
"ATTACHMENT",
167170
contentType
@@ -189,7 +192,7 @@ test("Get File Property (Binary)", async () => {
189192
var fileContent = readFileSync("test/test_data/test.jpg");
190193
var contentType: string = "image/jpeg";
191194
var blob = new Blob([Buffer.from(fileContent)], { type: contentType });
192-
var result = await myProxy.setFileProperty(
195+
var result = await myProxy.setActivityFileProperty(
193196
aid,
194197
"ATTACHMENT",
195198
blob,
@@ -202,7 +205,10 @@ test("Get File Property (Binary)", async () => {
202205
console.error(result);
203206
throw error;
204207
}
205-
var result = await myProxy.getFilePropertyMetadata(aid, "ATTACHMENT");
208+
var result = await myProxy.getActivityFilePropertyMetadata(
209+
aid,
210+
"ATTACHMENT"
211+
);
206212
try {
207213
expect(result.status).toBe(200);
208214
expect(result.data.size).toBe(fileContent.length);
@@ -213,7 +219,7 @@ test("Get File Property (Binary)", async () => {
213219
throw error;
214220
}
215221

216-
var result = await myProxy.getFilePropertyContent(
222+
var result = await myProxy.getActivityFilePropertyContent(
217223
aid,
218224
"ATTACHMENT",
219225
contentType
@@ -242,7 +248,7 @@ test("Get File Property (Full Binary)", async () => {
242248
var fileContent = readFileSync("test/test_data/test.jpg");
243249
var contentType: string = "image/jpeg";
244250
var blob = new Blob([Buffer.from(fileContent)], { type: contentType });
245-
var result = await myProxy.setFileProperty(
251+
var result = await myProxy.setActivityFileProperty(
246252
aid,
247253
"ATTACHMENT",
248254
blob,
@@ -255,7 +261,7 @@ test("Get File Property (Full Binary)", async () => {
255261
console.error(result);
256262
throw error;
257263
}
258-
var result = await myProxy.getFileProperty(aid, "ATTACHMENT");
264+
var result = await myProxy.getActivityFileProperty(aid, "ATTACHMENT");
259265
try {
260266
expect(result.status).toBe(200);
261267
expect(result.data.size).toBe(fileContent.length);

0 commit comments

Comments
 (0)