Skip to content

Commit b4b2db5

Browse files
committed
Further reduction for variables.
1 parent e6bb632 commit b4b2db5

File tree

1 file changed

+5
-73
lines changed
  • plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/codetest

1 file changed

+5
-73
lines changed

plugins/amazonq/codewhisperer/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codewhisperer/codetest/CodeTestSessionConfigTest.kt

Lines changed: 5 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,8 @@ class CodeTestSessionConfigTest {
2727
private lateinit var testJava: VirtualFile
2828
private lateinit var utilsJava: VirtualFile
2929
private lateinit var readMeMd: VirtualFile
30-
private lateinit var helpGo: VirtualFile
3130
private lateinit var utilsJs: VirtualFile
32-
private lateinit var testYaml: VirtualFile
3331
private lateinit var helperPy: VirtualFile
34-
private lateinit var testTf: VirtualFile
3532

3633
private var totalSize: Long = 0
3734
private var totalLines: Long = 0
@@ -55,17 +52,14 @@ class CodeTestSessionConfigTest {
5552
assertThat(project.modules.size).isEqualTo(2)
5653
val payload = codeTestSessionConfig.createPayload()
5754
assertThat(payload).isNotNull
58-
assertThat(payload.context.totalFiles).isEqualTo(8)
55+
assertThat(payload.context.totalFiles).isEqualTo(5)
5956

60-
assertThat(payload.context.scannedFiles.size).isEqualTo(8)
57+
assertThat(payload.context.scannedFiles.size).isEqualTo(5)
6158
assertThat(payload.context.scannedFiles).contains(
6259
testJava,
6360
utilsJava,
6461
readMeMd,
6562
utilsJs,
66-
helpGo,
67-
testYaml,
68-
testTf,
6963
helperPy
7064
)
7165

@@ -80,7 +74,7 @@ class CodeTestSessionConfigTest {
8074
filesInZip += 1
8175
}
8276

83-
assertThat(filesInZip).isEqualTo(12)
77+
assertThat(filesInZip).isEqualTo(9)
8478
}
8579

8680
@Test
@@ -91,7 +85,7 @@ class CodeTestSessionConfigTest {
9185
val srcPayloadSize = payloadMetadata.payloadSize
9286
val totalLines = payloadMetadata.linesScanned
9387
val maxCountLanguage = payloadMetadata.language
94-
assertThat(includedSourceFiles.size).isEqualTo(8)
88+
assertThat(includedSourceFiles.size).isEqualTo(5)
9589
assertThat(srcPayloadSize).isEqualTo(totalSize)
9690
assertThat(totalLines).isEqualTo(totalLines)
9791
assertThat(maxCountLanguage).isEqualTo(testJava.programmingLanguage().toTelemetryType())
@@ -195,22 +189,6 @@ class CodeTestSessionConfigTest {
195189
""".trimIndent()
196190
).virtualFile
197191

198-
helpGo = projectRule.fixture.addFileToModule(
199-
testModule,
200-
"/help.go",
201-
"""
202-
package main
203-
204-
import "fmt"
205-
206-
func Help() {
207-
fmt.Printf("./main")
208-
}
209-
""".trimIndent()
210-
).virtualFile
211-
totalSize += helpGo.length
212-
totalLines += helpGo.toNioPath().toFile().readLines().size
213-
214192
utilsJs = projectRule.fixture.addFileToModule(
215193
testModule,
216194
"/utils.js",
@@ -296,7 +274,7 @@ class CodeTestSessionConfigTest {
296274
).virtualFile
297275

298276
helperPy = projectRule.fixture.addFileToModule(
299-
testModule,
277+
testModule2,
300278
"/HelpersInPython/helper.py", // False positive testing
301279
"""
302280
from helpers import helper as h
@@ -317,52 +295,6 @@ class CodeTestSessionConfigTest {
317295
totalSize += readMeMd.length
318296
totalLines += readMeMd.toNioPath().toFile().readLines().size
319297

320-
testTf = projectRule.fixture.addFileToModule(
321-
testModule2,
322-
"/testTf.tf",
323-
"""
324-
# Create example resource for three S3 buckets using for_each, where the bucket prefix are in variable with list containing [prod, staging, dev]
325-
326-
resource "aws_s3_bucket" "example" {
327-
for_each = toset(var.names)
328-
bucket_prefix = each.value
329-
}
330-
331-
variable "names" {
332-
type = list(string)
333-
default = ["prod", "staging", "dev"]
334-
}
335-
""".trimIndent()
336-
).virtualFile
337-
totalSize += testTf.length
338-
totalLines += testTf.toNioPath().toFile().readLines().size
339-
340-
testYaml = projectRule.fixture.addFileToModule(
341-
testModule2,
342-
"/testYaml.yaml",
343-
"""
344-
AWSTemplateFormatVersion: "2010-09-09"
345-
346-
Description: |
347-
This stack creates a SNS topic using KMS encryption
348-
349-
Parameters:
350-
KmsKey:
351-
Description: The KMS key master ID
352-
Type: String
353-
354-
Resources:
355-
356-
# A SNS topic
357-
Topic:
358-
Type: AWS::SNS::Topic
359-
Properties:
360-
KmsMasterKeyId: !Ref KmsKey
361-
""".trimIndent()
362-
).virtualFile
363-
totalSize += testYaml.length
364-
totalLines += testYaml.toNioPath().toFile().readLines().size
365-
366298
// Adding gitignore file and gitignore file member for testing.
367299
// The tests include the markdown file but not these two files.
368300
projectRule.fixture.addFileToModule(

0 commit comments

Comments
 (0)