|
3 | 3 |
|
4 | 4 | package software.aws.toolkits.jetbrains.services.amazonq.lsp.artifacts |
5 | 5 |
|
| 6 | +import com.intellij.ide.plugins.PluginManagerCore |
| 7 | +import com.intellij.openapi.extensions.PluginId |
6 | 8 | import com.intellij.testFramework.ProjectExtension |
7 | 9 | import com.intellij.util.text.SemVer |
8 | 10 | import io.mockk.Runs |
@@ -51,29 +53,31 @@ class ArtifactManagerTest { |
51 | 53 | } |
52 | 54 |
|
53 | 55 | @Test |
54 | | - fun `fetch artifact fetcher throws exception if manifest is null`() = runTest { |
| 56 | + fun `fetch artifact fetcher returns bundled if manifest is null`() = runTest { |
55 | 57 | every { manifestFetcher.fetch() }.returns(null) |
56 | 58 |
|
57 | 59 | val exception = assertThrows<LspException> { |
58 | 60 | artifactManager.fetchArtifact(projectExtension.project) |
59 | 61 | } |
60 | | - assertThat(exception) |
61 | | - .hasFieldOrPropertyWithValue("errorCode", LspException.ErrorCode.MANIFEST_FETCH_FAILED) |
| 62 | + |
| 63 | + assertThat(artifactManager.fetchArtifact(projectExtension.project)) |
| 64 | + .isEqualTo( |
| 65 | + PluginManagerCore.getPlugin(PluginId.getId("amazon.q"))?.pluginPath?.resolve("flare") |
| 66 | + ) |
62 | 67 | } |
63 | 68 |
|
64 | 69 | @Test |
65 | | - fun `fetch artifact does not have any valid lsp versions`() = runTest { |
| 70 | + fun `fetch artifact does not have any valid lsp versions returns bundled`() = runTest { |
66 | 71 | every { manifestFetcher.fetch() }.returns(Manifest()) |
67 | 72 |
|
68 | 73 | every { artifactManager.getLSPVersionsFromManifestWithSpecifiedRange(any()) }.returns( |
69 | 74 | ArtifactManager.LSPVersions(deListedVersions = emptyList(), inRangeVersions = emptyList()) |
70 | 75 | ) |
71 | 76 |
|
72 | | - val exception = assertThrows<LspException> { |
73 | | - artifactManager.fetchArtifact(projectExtension.project) |
74 | | - } |
75 | | - assertThat(exception) |
76 | | - .hasFieldOrPropertyWithValue("errorCode", LspException.ErrorCode.NO_COMPATIBLE_LSP_VERSION) |
| 77 | + assertThat(artifactManager.fetchArtifact(projectExtension.project)) |
| 78 | + .isEqualTo( |
| 79 | + PluginManagerCore.getPlugin(PluginId.getId("amazon.q"))?.pluginPath?.resolve("flare") |
| 80 | + ) |
77 | 81 | } |
78 | 82 |
|
79 | 83 | @Test |
|
0 commit comments