tangled
alpha
login
or
join now
cosmik.network
/
semble
43
fork
atom
A social knowledge tool for researchers built on ATProto
43
fork
atom
overview
issues
13
pulls
pipelines
formatting and linting
Wesley Finck
4 months ago
93367382
178239ce
+16
-7
2 changed files
expand all
collapse all
unified
split
src
modules
cards
application
useCases
queries
GetUrlStatusForMyLibraryUseCase.ts
tests
infrastructure
DrizzleCardQueryRepository.getUrlCardBasic.integration.test.ts
+7
-4
src/modules/cards/application/useCases/queries/GetUrlStatusForMyLibraryUseCase.ts
···
101
);
102
103
if (authorProfileResult.isErr()) {
104
-
return err(AppError.UnexpectedError.create(authorProfileResult.error));
0
0
105
}
106
107
const authorProfile = authorProfileResult.value;
···
154
const fullCollection = collectionResult.value;
155
156
// Fetch author profile
157
-
const authorProfileResult = await this.profileService.getProfile(
158
-
fullCollection.authorId.value,
159
-
);
0
160
if (authorProfileResult.isErr()) {
161
throw new Error(
162
`Failed to fetch author profile: ${authorProfileResult.error.message}`,
···
101
);
102
103
if (authorProfileResult.isErr()) {
104
+
return err(
105
+
AppError.UnexpectedError.create(authorProfileResult.error),
106
+
);
107
}
108
109
const authorProfile = authorProfileResult.value;
···
156
const fullCollection = collectionResult.value;
157
158
// Fetch author profile
159
+
const authorProfileResult =
160
+
await this.profileService.getProfile(
161
+
fullCollection.authorId.value,
162
+
);
163
if (authorProfileResult.isErr()) {
164
throw new Error(
165
`Failed to fetch author profile: ${authorProfileResult.error.message}`,
+9
-3
src/modules/cards/tests/infrastructure/DrizzleCardQueryRepository.getUrlCardBasic.integration.test.ts
···
115
expect(result?.type).toBe(CardTypeEnum.URL);
116
expect(result?.url).toBe(url.value);
117
expect(result?.cardContent.title).toBe('Test Article');
118
-
expect(result?.cardContent.description).toBe('A test article description');
0
0
119
expect(result?.cardContent.author).toBe('John Doe');
120
-
expect(result?.cardContent.thumbnailUrl).toBe('https://example.com/image.jpg');
0
0
121
expect(result?.note).toBeUndefined();
122
});
123
···
152
153
it('should NOT include note card by a different author', async () => {
154
// Create URL card by first author
155
-
const url = URL.create('https://example.com/article-different-author').unwrap();
0
0
156
const urlCard = new CardBuilder()
157
.withCuratorId(curatorId.value)
158
.withUrlCard(url)
···
115
expect(result?.type).toBe(CardTypeEnum.URL);
116
expect(result?.url).toBe(url.value);
117
expect(result?.cardContent.title).toBe('Test Article');
118
+
expect(result?.cardContent.description).toBe(
119
+
'A test article description',
120
+
);
121
expect(result?.cardContent.author).toBe('John Doe');
122
+
expect(result?.cardContent.thumbnailUrl).toBe(
123
+
'https://example.com/image.jpg',
124
+
);
125
expect(result?.note).toBeUndefined();
126
});
127
···
156
157
it('should NOT include note card by a different author', async () => {
158
// Create URL card by first author
159
+
const url = URL.create(
160
+
'https://example.com/article-different-author',
161
+
).unwrap();
162
const urlCard = new CardBuilder()
163
.withCuratorId(curatorId.value)
164
.withUrlCard(url)