@edifice.io/community-client-rest-rn 1.0.0-develop-pedago.19 → 1.0.0-develop.20251204193721
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/clients/adapters/fetch-adapter.js +3 -7
- package/clients/adapters/fetch-adapter.js.map +1 -1
- package/clients/adapters/http-adapter.js +1 -2
- package/clients/adapters/http-service-adapter.js +1 -5
- package/clients/adapters/http-service-adapter.js.map +1 -1
- package/clients/announcement.client.js +2 -6
- package/clients/announcement.client.js.map +1 -1
- package/clients/base-api.client.js +5 -9
- package/clients/base-api.client.js.map +1 -1
- package/clients/community.client.js +8 -12
- package/clients/community.client.js.map +1 -1
- package/clients/discussion.client.js +2 -6
- package/clients/discussion.client.js.map +1 -1
- package/clients/errors/api-error.js +1 -5
- package/clients/errors/api-error.js.map +1 -1
- package/clients/folder.client.js +6 -6
- package/clients/folder.client.js.map +1 -1
- package/clients/index.d.ts +1 -0
- package/clients/index.js +12 -27
- package/clients/index.js.map +1 -1
- package/clients/invitation.client.js +11 -15
- package/clients/invitation.client.js.map +1 -1
- package/clients/membership.client.js +2 -6
- package/clients/membership.client.js.map +1 -1
- package/clients/resource.client.js +4 -6
- package/clients/resource.client.js.map +1 -1
- package/clients/wiki.client.js +2 -6
- package/clients/wiki.client.js.map +1 -1
- package/decorators/custom-type.decorator.browser.js +3 -8
- package/decorators/custom-type.decorator.browser.js.map +1 -1
- package/dtos/announcement.js +71 -82
- package/dtos/announcement.js.map +1 -1
- package/dtos/base.js +31 -38
- package/dtos/base.js.map +1 -1
- package/dtos/common.d.ts +10 -0
- package/dtos/common.js +38 -0
- package/dtos/common.js.map +1 -0
- package/dtos/community.d.ts +1 -10
- package/dtos/community.js +133 -170
- package/dtos/community.js.map +1 -1
- package/dtos/discussion.js +31 -41
- package/dtos/discussion.js.map +1 -1
- package/dtos/folder.js +56 -66
- package/dtos/folder.js.map +1 -1
- package/dtos/index.d.ts +1 -0
- package/dtos/index.js +10 -25
- package/dtos/index.js.map +1 -1
- package/dtos/invitation.d.ts +1 -1
- package/dtos/invitation.js +149 -168
- package/dtos/invitation.js.map +1 -1
- package/dtos/membership.js +66 -80
- package/dtos/membership.js.map +1 -1
- package/dtos/resource.d.ts +1 -0
- package/dtos/resource.js +116 -116
- package/dtos/resource.js.map +1 -1
- package/dtos/wiki.js +15 -22
- package/dtos/wiki.js.map +1 -1
- package/index.d.ts +1 -3
- package/index.js +3 -23
- package/index.js.map +1 -1
- package/mocks/index.js +1 -17
- package/mocks/index.js.map +1 -1
- package/mocks/search-community-response.mock.js +16 -25
- package/mocks/search-community-response.mock.js.map +1 -1
- package/package.json +5 -5
- package/tsconfig.browser.tsbuildinfo +1 -1
- package/utils/background-images.constants.d.ts +1 -1
- package/utils/background-images.constants.js +2 -5
- package/utils/background-images.constants.js.map +1 -1
- package/utils/community-image.types.js +1 -2
- package/utils/community-image.util.js +13 -26
- package/utils/community-image.util.js.map +1 -1
- package/utils/community-image.util.test.js +136 -138
- package/utils/community-image.util.test.js.map +1 -1
- package/utils/index.js +5 -21
- package/utils/index.js.map +1 -1
- package/utils/resource-url.util.js +12 -15
- package/utils/resource-url.util.js.map +1 -1
- package/utils/rights.utils.js +1 -4
- package/utils/rights.utils.js.map +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const BACKGROUND_IMAGES: readonly ["/defaultCover/school-green.png", "/defaultCover/school-yellow.png", "/defaultCover/reading-pink.png", "/defaultCover/reading-blue.png", "/defaultCover/sport-yellow.png", "/defaultCover/sport-orange.png", "/defaultCover/science-green.png", "/defaultCover/science-pink.png", "/defaultCover/admin-orange.png", "/defaultCover/admin-blue.png", "/defaultCover/travel-green.png", "/defaultCover/travel-blue.png"];
|
|
2
|
-
export type BackgroundImageKey = typeof BACKGROUND_IMAGES[number];
|
|
2
|
+
export type BackgroundImageKey = (typeof BACKGROUND_IMAGES)[number];
|
|
3
3
|
export declare const MOBILE_THUMBNAIL_MAPPING: Record<BackgroundImageKey, string[]>;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MOBILE_THUMBNAIL_MAPPING = exports.BACKGROUND_IMAGES = void 0;
|
|
4
|
-
exports.BACKGROUND_IMAGES = [
|
|
1
|
+
export const BACKGROUND_IMAGES = [
|
|
5
2
|
"/defaultCover/school-green.png",
|
|
6
3
|
"/defaultCover/school-yellow.png",
|
|
7
4
|
"/defaultCover/reading-pink.png",
|
|
@@ -15,7 +12,7 @@ exports.BACKGROUND_IMAGES = [
|
|
|
15
12
|
"/defaultCover/travel-green.png",
|
|
16
13
|
"/defaultCover/travel-blue.png",
|
|
17
14
|
];
|
|
18
|
-
|
|
15
|
+
export const MOBILE_THUMBNAIL_MAPPING = {
|
|
19
16
|
"/defaultCover/school-green.png": [
|
|
20
17
|
"/communities/public/mobile/defaultCover/school-green.png",
|
|
21
18
|
"/communities/public/mobile/defaultCover/school-green@2x.png",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background-images.constants.js","sourceRoot":"","sources":["../../../src/utils/background-images.constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"background-images.constants.js","sourceRoot":"","sources":["../../../src/utils/background-images.constants.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,gCAAgC;IAChC,iCAAiC;IACjC,gCAAgC;IAChC,gCAAgC;IAChC,gCAAgC;IAChC,gCAAgC;IAChC,iCAAiC;IACjC,gCAAgC;IAChC,gCAAgC;IAChC,8BAA8B;IAC9B,gCAAgC;IAChC,+BAA+B;CACvB,CAAC;AAQX,MAAM,CAAC,MAAM,wBAAwB,GAAyC;IAC5E,gCAAgC,EAAE;QAChC,0DAA0D;QAC1D,6DAA6D;QAC7D,6DAA6D;KAC9D;IACD,iCAAiC,EAAE;QACjC,2DAA2D;QAC3D,8DAA8D;QAC9D,8DAA8D;KAC/D;IACD,gCAAgC,EAAE;QAChC,0DAA0D;QAC1D,6DAA6D;QAC7D,6DAA6D;KAC9D;IACD,gCAAgC,EAAE;QAChC,0DAA0D;QAC1D,6DAA6D;QAC7D,6DAA6D;KAC9D;IACD,gCAAgC,EAAE;QAChC,0DAA0D;QAC1D,6DAA6D;QAC7D,6DAA6D;KAC9D;IACD,gCAAgC,EAAE;QAChC,0DAA0D;QAC1D,6DAA6D;QAC7D,6DAA6D;KAC9D;IACD,iCAAiC,EAAE;QACjC,2DAA2D;QAC3D,8DAA8D;QAC9D,8DAA8D;KAC/D;IACD,gCAAgC,EAAE;QAChC,0DAA0D;QAC1D,6DAA6D;QAC7D,6DAA6D;KAC9D;IACD,gCAAgC,EAAE;QAChC,0DAA0D;QAC1D,6DAA6D;QAC7D,6DAA6D;KAC9D;IACD,8BAA8B,EAAE;QAC9B,wDAAwD;QACxD,2DAA2D;QAC3D,2DAA2D;KAC5D;IACD,gCAAgC,EAAE;QAChC,0DAA0D;QAC1D,6DAA6D;QAC7D,6DAA6D;KAC9D;IACD,+BAA+B,EAAE;QAC/B,yDAAyD;QACzD,4DAA4D;QAC5D,4DAA4D;KAC7D;CACF,CAAC"}
|
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertToMobileThumbnails = convertToMobileThumbnails;
|
|
4
|
-
exports.mapCommunityWithThumbnails = mapCommunityWithThumbnails;
|
|
5
|
-
exports.mapCommunitySummaryWithThumbnails = mapCommunitySummaryWithThumbnails;
|
|
6
|
-
exports.mapInvitationWithThumbnails = mapInvitationWithThumbnails;
|
|
7
|
-
exports.mapInvitationOrMemberWithThumbnails = mapInvitationOrMemberWithThumbnails;
|
|
8
|
-
exports.mapCommunitiesWithThumbnails = mapCommunitiesWithThumbnails;
|
|
9
|
-
exports.mapInvitationsWithThumbnails = mapInvitationsWithThumbnails;
|
|
10
|
-
exports.mapInvitationsOrMembersWithThumbnails = mapInvitationsOrMembersWithThumbnails;
|
|
11
|
-
exports.mapSearchCommunityResponse = mapSearchCommunityResponse;
|
|
12
|
-
exports.mapSearchInvitationResponse = mapSearchInvitationResponse;
|
|
13
|
-
exports.mapSearchInvitationAndMembersResponse = mapSearchInvitationAndMembersResponse;
|
|
14
|
-
const background_images_constants_1 = require("./background-images.constants");
|
|
1
|
+
import { MOBILE_THUMBNAIL_MAPPING } from "./background-images.constants";
|
|
15
2
|
function normalizeImagePath(imagePath) {
|
|
16
3
|
if (imagePath.startsWith("/communities/public/")) {
|
|
17
4
|
return imagePath.replace("/communities/public", "");
|
|
@@ -21,12 +8,12 @@ function normalizeImagePath(imagePath) {
|
|
|
21
8
|
}
|
|
22
9
|
return imagePath;
|
|
23
10
|
}
|
|
24
|
-
function convertToMobileThumbnails(imagePath) {
|
|
11
|
+
export function convertToMobileThumbnails(imagePath) {
|
|
25
12
|
if (!imagePath) {
|
|
26
13
|
return [];
|
|
27
14
|
}
|
|
28
15
|
const normalizedPath = normalizeImagePath(imagePath);
|
|
29
|
-
const mobileUrls =
|
|
16
|
+
const mobileUrls = MOBILE_THUMBNAIL_MAPPING[normalizedPath];
|
|
30
17
|
if (mobileUrls) {
|
|
31
18
|
return [
|
|
32
19
|
{ uri: mobileUrls[0], scale: 1 },
|
|
@@ -36,19 +23,19 @@ function convertToMobileThumbnails(imagePath) {
|
|
|
36
23
|
}
|
|
37
24
|
return [];
|
|
38
25
|
}
|
|
39
|
-
function mapCommunityWithThumbnails(community) {
|
|
26
|
+
export function mapCommunityWithThumbnails(community) {
|
|
40
27
|
return {
|
|
41
28
|
...community,
|
|
42
29
|
mobileThumbnails: convertToMobileThumbnails(community.image),
|
|
43
30
|
};
|
|
44
31
|
}
|
|
45
|
-
function mapCommunitySummaryWithThumbnails(community) {
|
|
32
|
+
export function mapCommunitySummaryWithThumbnails(community) {
|
|
46
33
|
return {
|
|
47
34
|
...community,
|
|
48
35
|
mobileThumbnails: convertToMobileThumbnails(community.image),
|
|
49
36
|
};
|
|
50
37
|
}
|
|
51
|
-
function mapInvitationWithThumbnails(invitation) {
|
|
38
|
+
export function mapInvitationWithThumbnails(invitation) {
|
|
52
39
|
return {
|
|
53
40
|
...invitation,
|
|
54
41
|
community: invitation.community
|
|
@@ -56,7 +43,7 @@ function mapInvitationWithThumbnails(invitation) {
|
|
|
56
43
|
: undefined,
|
|
57
44
|
};
|
|
58
45
|
}
|
|
59
|
-
function mapInvitationOrMemberWithThumbnails(item) {
|
|
46
|
+
export function mapInvitationOrMemberWithThumbnails(item) {
|
|
60
47
|
return {
|
|
61
48
|
...item,
|
|
62
49
|
community: item.community
|
|
@@ -64,28 +51,28 @@ function mapInvitationOrMemberWithThumbnails(item) {
|
|
|
64
51
|
: undefined,
|
|
65
52
|
};
|
|
66
53
|
}
|
|
67
|
-
function mapCommunitiesWithThumbnails(communities) {
|
|
54
|
+
export function mapCommunitiesWithThumbnails(communities) {
|
|
68
55
|
return communities.map(mapCommunityWithThumbnails);
|
|
69
56
|
}
|
|
70
|
-
function mapInvitationsWithThumbnails(invitations) {
|
|
57
|
+
export function mapInvitationsWithThumbnails(invitations) {
|
|
71
58
|
return invitations.map(mapInvitationWithThumbnails);
|
|
72
59
|
}
|
|
73
|
-
function mapInvitationsOrMembersWithThumbnails(items) {
|
|
60
|
+
export function mapInvitationsOrMembersWithThumbnails(items) {
|
|
74
61
|
return items.map(mapInvitationOrMemberWithThumbnails);
|
|
75
62
|
}
|
|
76
|
-
function mapSearchCommunityResponse(response) {
|
|
63
|
+
export function mapSearchCommunityResponse(response) {
|
|
77
64
|
return {
|
|
78
65
|
...response,
|
|
79
66
|
items: mapCommunitiesWithThumbnails(response.items),
|
|
80
67
|
};
|
|
81
68
|
}
|
|
82
|
-
function mapSearchInvitationResponse(response) {
|
|
69
|
+
export function mapSearchInvitationResponse(response) {
|
|
83
70
|
return {
|
|
84
71
|
...response,
|
|
85
72
|
items: mapInvitationsWithThumbnails(response.items),
|
|
86
73
|
};
|
|
87
74
|
}
|
|
88
|
-
function mapSearchInvitationAndMembersResponse(response) {
|
|
75
|
+
export function mapSearchInvitationAndMembersResponse(response) {
|
|
89
76
|
return {
|
|
90
77
|
...response,
|
|
91
78
|
items: mapInvitationsOrMembersWithThumbnails(response.items),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"community-image.util.js","sourceRoot":"","sources":["../../../src/utils/community-image.util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"community-image.util.js","sourceRoot":"","sources":["../../../src/utils/community-image.util.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(0, vitest_1.expect)(result).toHaveLength(3);
|
|
10
|
-
(0, vitest_1.expect)(result[0]).toEqual({
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { convertToMobileThumbnails, mapCommunityWithThumbnails, mapCommunitySummaryWithThumbnails, mapInvitationWithThumbnails, mapInvitationOrMemberWithThumbnails, mapCommunitiesWithThumbnails, mapInvitationsWithThumbnails, mapInvitationsOrMembersWithThumbnails, } from "./community-image.util";
|
|
3
|
+
describe("convertToMobileThumbnails", () => {
|
|
4
|
+
describe("with /defaultCover/ format", () => {
|
|
5
|
+
it("should convert /defaultCover/admin-blue.png to mobile thumbnails", () => {
|
|
6
|
+
const result = convertToMobileThumbnails("/defaultCover/admin-blue.png");
|
|
7
|
+
expect(result).toHaveLength(3);
|
|
8
|
+
expect(result[0]).toEqual({
|
|
11
9
|
uri: "/communities/public/mobile/defaultCover/admin-blue.png",
|
|
12
10
|
scale: 1,
|
|
13
11
|
});
|
|
14
|
-
|
|
12
|
+
expect(result[1]).toEqual({
|
|
15
13
|
uri: "/communities/public/mobile/defaultCover/admin-blue@2x.png",
|
|
16
14
|
scale: 2,
|
|
17
15
|
});
|
|
18
|
-
|
|
16
|
+
expect(result[2]).toEqual({
|
|
19
17
|
uri: "/communities/public/mobile/defaultCover/admin-blue@3x.png",
|
|
20
18
|
scale: 3,
|
|
21
19
|
});
|
|
22
20
|
});
|
|
23
|
-
|
|
24
|
-
const result =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
it("should convert /defaultCover/school-green.png to mobile thumbnails", () => {
|
|
22
|
+
const result = convertToMobileThumbnails("/defaultCover/school-green.png");
|
|
23
|
+
expect(result).toHaveLength(3);
|
|
24
|
+
expect(result[0].uri).toBe("/communities/public/mobile/defaultCover/school-green.png");
|
|
25
|
+
expect(result[1].uri).toBe("/communities/public/mobile/defaultCover/school-green@2x.png");
|
|
26
|
+
expect(result[2].uri).toBe("/communities/public/mobile/defaultCover/school-green@3x.png");
|
|
29
27
|
});
|
|
30
|
-
|
|
28
|
+
it("should convert all background images", () => {
|
|
31
29
|
const backgroundImages = [
|
|
32
30
|
"/defaultCover/school-green.png",
|
|
33
31
|
"/defaultCover/school-yellow.png",
|
|
@@ -43,132 +41,132 @@ const community_image_util_1 = require("./community-image.util");
|
|
|
43
41
|
"/defaultCover/travel-blue.png",
|
|
44
42
|
];
|
|
45
43
|
backgroundImages.forEach((imagePath) => {
|
|
46
|
-
const result =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
const result = convertToMobileThumbnails(imagePath);
|
|
45
|
+
expect(result).toHaveLength(3);
|
|
46
|
+
expect(result[0].scale).toBe(1);
|
|
47
|
+
expect(result[1].scale).toBe(2);
|
|
48
|
+
expect(result[2].scale).toBe(3);
|
|
51
49
|
});
|
|
52
50
|
});
|
|
53
51
|
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const result =
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
describe("with /communities/defaultCover/ format", () => {
|
|
53
|
+
it("should convert /communities/defaultCover/admin-blue.png to mobile thumbnails", () => {
|
|
54
|
+
const result = convertToMobileThumbnails("/communities/defaultCover/admin-blue.png");
|
|
55
|
+
expect(result).toHaveLength(3);
|
|
56
|
+
expect(result[0]).toEqual({
|
|
59
57
|
uri: "/communities/public/mobile/defaultCover/admin-blue.png",
|
|
60
58
|
scale: 1,
|
|
61
59
|
});
|
|
62
|
-
|
|
60
|
+
expect(result[1]).toEqual({
|
|
63
61
|
uri: "/communities/public/mobile/defaultCover/admin-blue@2x.png",
|
|
64
62
|
scale: 2,
|
|
65
63
|
});
|
|
66
|
-
|
|
64
|
+
expect(result[2]).toEqual({
|
|
67
65
|
uri: "/communities/public/mobile/defaultCover/admin-blue@3x.png",
|
|
68
66
|
scale: 3,
|
|
69
67
|
});
|
|
70
68
|
});
|
|
71
|
-
|
|
72
|
-
const result1 =
|
|
73
|
-
const result2 =
|
|
74
|
-
|
|
69
|
+
it("should handle /communities/defaultCover/ format consistently with /defaultCover/", () => {
|
|
70
|
+
const result1 = convertToMobileThumbnails("/defaultCover/admin-blue.png");
|
|
71
|
+
const result2 = convertToMobileThumbnails("/communities/defaultCover/admin-blue.png");
|
|
72
|
+
expect(result1).toEqual(result2);
|
|
75
73
|
});
|
|
76
74
|
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const result =
|
|
80
|
-
|
|
75
|
+
describe("with no image", () => {
|
|
76
|
+
it("should return empty array when imagePath is undefined", () => {
|
|
77
|
+
const result = convertToMobileThumbnails(undefined);
|
|
78
|
+
expect(result).toEqual([]);
|
|
81
79
|
});
|
|
82
|
-
|
|
83
|
-
const result =
|
|
84
|
-
|
|
80
|
+
it("should return empty array when imagePath is null", () => {
|
|
81
|
+
const result = convertToMobileThumbnails(null);
|
|
82
|
+
expect(result).toEqual([]);
|
|
85
83
|
});
|
|
86
|
-
|
|
87
|
-
const result =
|
|
88
|
-
|
|
84
|
+
it("should return empty array when imagePath is empty string", () => {
|
|
85
|
+
const result = convertToMobileThumbnails("");
|
|
86
|
+
expect(result).toEqual([]);
|
|
89
87
|
});
|
|
90
88
|
});
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const result =
|
|
94
|
-
|
|
89
|
+
describe("with external URL", () => {
|
|
90
|
+
it("should return empty array for external URL (not in mapping)", () => {
|
|
91
|
+
const result = convertToMobileThumbnails("https://example.com/image.png");
|
|
92
|
+
expect(result).toEqual([]);
|
|
95
93
|
});
|
|
96
|
-
|
|
97
|
-
const result =
|
|
98
|
-
|
|
94
|
+
it("should return empty array for unknown image path", () => {
|
|
95
|
+
const result = convertToMobileThumbnails("/defaultCover/unknown-image.png");
|
|
96
|
+
expect(result).toEqual([]);
|
|
99
97
|
});
|
|
100
98
|
});
|
|
101
99
|
});
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
describe("mapCommunityWithThumbnails", () => {
|
|
101
|
+
it("should add mobileThumbnails to CommunityResponseDto", () => {
|
|
104
102
|
const community = {
|
|
105
103
|
id: 1,
|
|
106
104
|
title: "Test Community",
|
|
107
105
|
image: "/defaultCover/admin-blue.png",
|
|
108
106
|
};
|
|
109
|
-
const result =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
107
|
+
const result = mapCommunityWithThumbnails(community);
|
|
108
|
+
expect(result.id).toBe(1);
|
|
109
|
+
expect(result.title).toBe("Test Community");
|
|
110
|
+
expect(result.image).toBe("/defaultCover/admin-blue.png");
|
|
111
|
+
expect(result.mobileThumbnails).toHaveLength(3);
|
|
112
|
+
expect(result.mobileThumbnails[0].scale).toBe(1);
|
|
113
|
+
expect(result.mobileThumbnails[1].scale).toBe(2);
|
|
114
|
+
expect(result.mobileThumbnails[2].scale).toBe(3);
|
|
117
115
|
});
|
|
118
|
-
|
|
116
|
+
it("should handle community with /communities/defaultCover/ format", () => {
|
|
119
117
|
const community = {
|
|
120
118
|
id: 1,
|
|
121
119
|
title: "Test Community",
|
|
122
120
|
image: "/communities/defaultCover/admin-blue.png",
|
|
123
121
|
};
|
|
124
|
-
const result =
|
|
125
|
-
|
|
122
|
+
const result = mapCommunityWithThumbnails(community);
|
|
123
|
+
expect(result.mobileThumbnails).toHaveLength(3);
|
|
126
124
|
});
|
|
127
|
-
|
|
125
|
+
it("should handle community with no image", () => {
|
|
128
126
|
const community = {
|
|
129
127
|
id: 1,
|
|
130
128
|
title: "Test Community",
|
|
131
129
|
image: undefined,
|
|
132
130
|
};
|
|
133
|
-
const result =
|
|
134
|
-
|
|
131
|
+
const result = mapCommunityWithThumbnails(community);
|
|
132
|
+
expect(result.mobileThumbnails).toEqual([]);
|
|
135
133
|
});
|
|
136
|
-
|
|
134
|
+
it("should handle community with external URL", () => {
|
|
137
135
|
const community = {
|
|
138
136
|
id: 1,
|
|
139
137
|
title: "Test Community",
|
|
140
138
|
image: "https://example.com/image.png",
|
|
141
139
|
};
|
|
142
|
-
const result =
|
|
143
|
-
|
|
140
|
+
const result = mapCommunityWithThumbnails(community);
|
|
141
|
+
expect(result.mobileThumbnails).toEqual([]);
|
|
144
142
|
});
|
|
145
143
|
});
|
|
146
|
-
|
|
147
|
-
|
|
144
|
+
describe("mapCommunitySummaryWithThumbnails", () => {
|
|
145
|
+
it("should add mobileThumbnails to CommunitySummaryDto", () => {
|
|
148
146
|
const community = {
|
|
149
147
|
id: 1,
|
|
150
148
|
title: "Test Community",
|
|
151
149
|
image: "/defaultCover/school-green.png",
|
|
152
150
|
};
|
|
153
|
-
const result =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
const result = mapCommunitySummaryWithThumbnails(community);
|
|
152
|
+
expect(result.id).toBe(1);
|
|
153
|
+
expect(result.title).toBe("Test Community");
|
|
154
|
+
expect(result.mobileThumbnails).toHaveLength(3);
|
|
157
155
|
});
|
|
158
|
-
|
|
156
|
+
it("should preserve original properties", () => {
|
|
159
157
|
const community = {
|
|
160
158
|
id: 1,
|
|
161
159
|
title: "Test Community",
|
|
162
160
|
image: "/defaultCover/school-green.png",
|
|
163
161
|
};
|
|
164
|
-
const result =
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
const result = mapCommunitySummaryWithThumbnails(community);
|
|
163
|
+
expect(result.id).toBe(1);
|
|
164
|
+
expect(result.title).toBe("Test Community");
|
|
165
|
+
expect(result.image).toBe("/defaultCover/school-green.png");
|
|
168
166
|
});
|
|
169
167
|
});
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
describe("mapInvitationWithThumbnails", () => {
|
|
169
|
+
it("should add mobileThumbnails to community in invitation", () => {
|
|
172
170
|
const invitation = {
|
|
173
171
|
id: 1,
|
|
174
172
|
status: "PENDING",
|
|
@@ -178,24 +176,24 @@ const community_image_util_1 = require("./community-image.util");
|
|
|
178
176
|
image: "/defaultCover/admin-blue.png",
|
|
179
177
|
},
|
|
180
178
|
};
|
|
181
|
-
const result =
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
179
|
+
const result = mapInvitationWithThumbnails(invitation);
|
|
180
|
+
expect(result.id).toBe(1);
|
|
181
|
+
expect(result.status).toBe("PENDING");
|
|
182
|
+
expect(result.community?.mobileThumbnails).toHaveLength(3);
|
|
185
183
|
});
|
|
186
|
-
|
|
184
|
+
it("should handle invitation without community", () => {
|
|
187
185
|
const invitation = {
|
|
188
186
|
id: 1,
|
|
189
187
|
status: "PENDING",
|
|
190
188
|
community: undefined,
|
|
191
189
|
};
|
|
192
|
-
const result =
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
const result = mapInvitationWithThumbnails(invitation);
|
|
191
|
+
expect(result.id).toBe(1);
|
|
192
|
+
expect(result.community).toBeUndefined();
|
|
195
193
|
});
|
|
196
194
|
});
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
describe("mapInvitationOrMemberWithThumbnails", () => {
|
|
196
|
+
it("should add mobileThumbnails to community in invitation or member", () => {
|
|
199
197
|
const item = {
|
|
200
198
|
id: 1,
|
|
201
199
|
community: {
|
|
@@ -204,22 +202,22 @@ const community_image_util_1 = require("./community-image.util");
|
|
|
204
202
|
image: "/defaultCover/reading-pink.png",
|
|
205
203
|
},
|
|
206
204
|
};
|
|
207
|
-
const result =
|
|
208
|
-
|
|
209
|
-
|
|
205
|
+
const result = mapInvitationOrMemberWithThumbnails(item);
|
|
206
|
+
expect(result.id).toBe(1);
|
|
207
|
+
expect(result.community?.mobileThumbnails).toHaveLength(3);
|
|
210
208
|
});
|
|
211
|
-
|
|
209
|
+
it("should handle item without community", () => {
|
|
212
210
|
const item = {
|
|
213
211
|
id: 1,
|
|
214
212
|
community: undefined,
|
|
215
213
|
};
|
|
216
|
-
const result =
|
|
217
|
-
|
|
218
|
-
|
|
214
|
+
const result = mapInvitationOrMemberWithThumbnails(item);
|
|
215
|
+
expect(result.id).toBe(1);
|
|
216
|
+
expect(result.community).toBeUndefined();
|
|
219
217
|
});
|
|
220
218
|
});
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
describe("mapCommunitiesWithThumbnails", () => {
|
|
220
|
+
it("should map array of communities", () => {
|
|
223
221
|
const communities = [
|
|
224
222
|
{
|
|
225
223
|
id: 1,
|
|
@@ -232,17 +230,17 @@ const community_image_util_1 = require("./community-image.util");
|
|
|
232
230
|
image: "/defaultCover/school-green.png",
|
|
233
231
|
},
|
|
234
232
|
];
|
|
235
|
-
const result =
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
233
|
+
const result = mapCommunitiesWithThumbnails(communities);
|
|
234
|
+
expect(result).toHaveLength(2);
|
|
235
|
+
expect(result[0].mobileThumbnails).toHaveLength(3);
|
|
236
|
+
expect(result[1].mobileThumbnails).toHaveLength(3);
|
|
239
237
|
});
|
|
240
|
-
|
|
238
|
+
it("should handle empty array", () => {
|
|
241
239
|
const communities = [];
|
|
242
|
-
const result =
|
|
243
|
-
|
|
240
|
+
const result = mapCommunitiesWithThumbnails(communities);
|
|
241
|
+
expect(result).toEqual([]);
|
|
244
242
|
});
|
|
245
|
-
|
|
243
|
+
it("should handle array with mixed image types", () => {
|
|
246
244
|
const communities = [
|
|
247
245
|
{
|
|
248
246
|
id: 1,
|
|
@@ -260,15 +258,15 @@ const community_image_util_1 = require("./community-image.util");
|
|
|
260
258
|
image: "https://example.com/image.png",
|
|
261
259
|
},
|
|
262
260
|
];
|
|
263
|
-
const result =
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
261
|
+
const result = mapCommunitiesWithThumbnails(communities);
|
|
262
|
+
expect(result).toHaveLength(3);
|
|
263
|
+
expect(result[0].mobileThumbnails).toHaveLength(3);
|
|
264
|
+
expect(result[1].mobileThumbnails).toEqual([]);
|
|
265
|
+
expect(result[2].mobileThumbnails).toEqual([]);
|
|
268
266
|
});
|
|
269
267
|
});
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
describe("mapInvitationsWithThumbnails", () => {
|
|
269
|
+
it("should map array of invitations", () => {
|
|
272
270
|
const invitations = [
|
|
273
271
|
{
|
|
274
272
|
id: 1,
|
|
@@ -289,19 +287,19 @@ const community_image_util_1 = require("./community-image.util");
|
|
|
289
287
|
},
|
|
290
288
|
},
|
|
291
289
|
];
|
|
292
|
-
const result =
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
290
|
+
const result = mapInvitationsWithThumbnails(invitations);
|
|
291
|
+
expect(result).toHaveLength(2);
|
|
292
|
+
expect(result[0].community?.mobileThumbnails).toHaveLength(3);
|
|
293
|
+
expect(result[1].community?.mobileThumbnails).toHaveLength(3);
|
|
296
294
|
});
|
|
297
|
-
|
|
295
|
+
it("should handle empty array", () => {
|
|
298
296
|
const invitations = [];
|
|
299
|
-
const result =
|
|
300
|
-
|
|
297
|
+
const result = mapInvitationsWithThumbnails(invitations);
|
|
298
|
+
expect(result).toEqual([]);
|
|
301
299
|
});
|
|
302
300
|
});
|
|
303
|
-
|
|
304
|
-
|
|
301
|
+
describe("mapInvitationsOrMembersWithThumbnails", () => {
|
|
302
|
+
it("should map array of invitations or members", () => {
|
|
305
303
|
const items = [
|
|
306
304
|
{
|
|
307
305
|
id: 1,
|
|
@@ -320,17 +318,17 @@ const community_image_util_1 = require("./community-image.util");
|
|
|
320
318
|
},
|
|
321
319
|
},
|
|
322
320
|
];
|
|
323
|
-
const result =
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
321
|
+
const result = mapInvitationsOrMembersWithThumbnails(items);
|
|
322
|
+
expect(result).toHaveLength(2);
|
|
323
|
+
expect(result[0].community?.mobileThumbnails).toHaveLength(3);
|
|
324
|
+
expect(result[1].community?.mobileThumbnails).toHaveLength(3);
|
|
327
325
|
});
|
|
328
|
-
|
|
326
|
+
it("should handle empty array", () => {
|
|
329
327
|
const items = [];
|
|
330
|
-
const result =
|
|
331
|
-
|
|
328
|
+
const result = mapInvitationsOrMembersWithThumbnails(items);
|
|
329
|
+
expect(result).toEqual([]);
|
|
332
330
|
});
|
|
333
|
-
|
|
331
|
+
it("should handle mixed formats in array", () => {
|
|
334
332
|
const items = [
|
|
335
333
|
{
|
|
336
334
|
id: 1,
|
|
@@ -349,9 +347,9 @@ const community_image_util_1 = require("./community-image.util");
|
|
|
349
347
|
},
|
|
350
348
|
},
|
|
351
349
|
];
|
|
352
|
-
const result =
|
|
353
|
-
|
|
354
|
-
|
|
350
|
+
const result = mapInvitationsOrMembersWithThumbnails(items);
|
|
351
|
+
expect(result).toHaveLength(2);
|
|
352
|
+
expect(result[0].community?.mobileThumbnails).toEqual(result[1].community?.mobileThumbnails);
|
|
355
353
|
});
|
|
356
354
|
});
|
|
357
355
|
//# sourceMappingURL=community-image.util.test.js.map
|