Skip to content

Commit d609530

Browse files
authored
Merge pull request #1394 from lowcoder-org/fix/testcase
Add mising test case and migration
2 parents 06a50a3 + 7076c14 commit d609530

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

server/api-service/lowcoder-server/src/main/java/org/lowcoder/runner/migrations/DatabaseChangelog.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ public void publishedToRecord(MongockTemplate mongoTemplate, CommonConfig common
451451
mongoTemplate.insert(record);
452452
}
453453
}
454+
@ChangeSet(order = "029", id = "add-tag-index-to-record", author = "Thomas")
455+
public void addTagIndexToRecord(MongockTemplate mongoTemplate, CommonConfig commonConfig) {
456+
ensureIndexes(mongoTemplate, ApplicationRecord.class, makeIndex("applicationId", "tag").unique());
457+
}
454458

455459
private void addGidField(MongockTemplate mongoTemplate, String collectionName) {
456460
// Create a query to match all documents

server/api-service/lowcoder-server/src/test/java/org/lowcoder/api/application/ApplicationApiServiceTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public void testPublishApplication() {
179179
.assertNext(applicationView -> Assertions.assertEquals(Map.of("comp", "list"), applicationView.getApplicationDSL()))
180180
.verifyComplete();
181181

182-
// publish
182+
// publish 2
183183
applicationIdMono = applicationIdMono
184184
.delayUntil(id -> applicationApiService.publish(id, new ApplicationPublishRequest("Test Publish 2", "2.0.0"))).cache();
185185

@@ -192,6 +192,14 @@ public void testPublishApplication() {
192192
StepVerifier.create(applicationIdMono.flatMap(id -> applicationApiService.getPublishedApplication(id, ApplicationRequestType.PUBLIC_TO_ALL)))
193193
.assertNext(applicationView -> Assertions.assertEquals(Map.of("comp", "table"), applicationView.getApplicationDSL()))
194194
.verifyComplete();
195+
196+
// publish 3
197+
applicationIdMono = applicationIdMono
198+
.delayUntil(id -> applicationApiService.publish(id, new ApplicationPublishRequest("Same tag", "2.0.0"))).cache();
199+
200+
// Error
201+
StepVerifier.create(applicationIdMono)
202+
.verifyError();
195203
}
196204

197205
@Test

0 commit comments

Comments
 (0)