-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release' into chore/visual-changes-navigation
- Loading branch information
Showing
12 changed files
with
732 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...th-plugins/appsmithAiPlugin/src/test/java/com/external/plugins/services/FileUtilTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.external.plugins.services; | ||
|
||
import com.appsmith.external.models.DatasourceConfiguration; | ||
import com.appsmith.external.models.Property; | ||
import com.external.plugins.utils.FileUtils; | ||
import org.junit.jupiter.api.Test; | ||
import org.testcontainers.junit.jupiter.Testcontainers; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@Testcontainers | ||
public class FileUtilTest { | ||
@Test | ||
public void getFileIds_withNullDatasourceConfig_returnsEmptyList() { | ||
DatasourceConfiguration datasourceConfiguration = null; | ||
List<String> actualFileIds = FileUtils.getFileIds(datasourceConfiguration); | ||
assertThat(actualFileIds).isEmpty(); | ||
} | ||
|
||
@Test | ||
public void getFileIds_withValidDatasourceConfig_returnsFileIdList() { | ||
DatasourceConfiguration datasourceConfiguration = new DatasourceConfiguration(); | ||
datasourceConfiguration.setUrl("https://example.com"); | ||
|
||
// create file object | ||
Map<String, Object> fileMap = new HashMap<String, Object>(); | ||
fileMap.put("id", "fileId"); | ||
fileMap.put("name", "fileName"); | ||
fileMap.put("size", 10); | ||
fileMap.put("mimetype", "fileMimetype"); | ||
|
||
Property property = new Property(); | ||
property.setKey("Files"); | ||
property.setValue(List.of(fileMap)); | ||
|
||
datasourceConfiguration.setProperties(List.of(property)); | ||
List<String> actualFileIds = FileUtils.getFileIds(datasourceConfiguration); | ||
assertThat(actualFileIds).contains("fileId"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.