Skip to content

Commit

Permalink
fix testSuccessNotificationAfterInstalled test
Browse files Browse the repository at this point in the history
Signed-off-by: Stelios Mavrommatakis <[email protected]>
Co-authored-by: Yorgos Saslis <[email protected]>
Signed-off-by: Yorgos Saslis <[email protected]>
  • Loading branch information
2 people authored and gsaslis committed Dec 21, 2023
1 parent e1c1d39 commit 5deb39e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public String getRadHome() {
return getApplicationProperties().getValue(RAD_HOME_KEY, "");
}

private String getPath() {
public String getPath() {
return getApplicationProperties().getValue(PATH_KEY, "");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public Object execute(@NotNull Project project, @NotNull Continuation<? super Un

private void showSuccessNotification(Project project) {
var radicleSettingsHandler = new RadicleProjectSettingsHandler(project);
final String radPath = project.getService(RadicleProjectService.class).detectRadPath();
final String radPath = detectRadPath(project);
radicleSettingsHandler.savePath(radPath);
radicleSettingsHandler.saveRadHome(project.getService(RadicleProjectService.class).detectRadHome(radPath));
// radicleSettingsHandler.savePath("");

Check notice on line 31 in src/main/java/network/radicle/jetbrains/radiclejetbrainsplugin/listeners/RadicleManagerListener.java

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Commented out code

Commented out code (2 lines)
Expand All @@ -36,4 +36,9 @@ private void showSuccessNotification(Project project) {
List.of(new RadAction.ConfigureRadCliNotificationAction(project, RadicleBundle.lazyMessage("configure"))));
}
}

public String detectRadPath(Project project) {
return project.getService(RadicleProjectService.class).detectRadPath();
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package network.radicle.jetbrains.radiclejetbrainsplugin;

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import git4idea.repo.GitRepository;
import network.radicle.jetbrains.radiclejetbrainsplugin.actions.RadicleSyncAction;
import network.radicle.jetbrains.radiclejetbrainsplugin.actions.RadicleSyncFetchAction;
Expand Down Expand Up @@ -113,18 +114,23 @@ public void radFetchAction() throws InterruptedException {

@Test
public void testSuccessNotificationAfterInstalled() throws InterruptedException {
radicleProjectSettingsHandler.savePath("");
var rm = new RadicleManagerListener();
rm.execute(getProject(), NoopContinuation.NOOP);

var not = notificationsQueue.poll(10, TimeUnit.SECONDS);
assertThat(not).isNotNull();
assertThat(not.getContent()).contains(RadicleBundle.message("installedSuccessfully"));

radicleProjectSettingsHandler.savePath(RAD_PATH);
rm.execute(getProject(), NoopContinuation.NOOP);
not = notificationsQueue.poll(100, TimeUnit.MILLISECONDS);
assertThat(not).isNull();
assertThat(radicleProjectSettingsHandler.getRadHome()).isEqualTo(RAD_HOME);
assertThat(radicleProjectSettingsHandler.getPath()).isEqualTo(RAD_PATH);

rm = new RadicleManagerListener() {
@Override
public String detectRadPath(Project project) {
return "";
}
};
rm.execute(getProject(), NoopContinuation.NOOP);
not = notificationsQueue.poll(10, TimeUnit.SECONDS);
assertThat(not.getContent()).contains(RadicleBundle.message("installedSuccessfully"));
}

@Test
Expand Down

0 comments on commit 5deb39e

Please sign in to comment.