aws / aws-toolkit-vscode

Amazon Q, CodeCatalyst, Local Lambda debug, SAM/CFN syntax, ECS Terminal, AWS resources
https://marketplace.visualstudio.com/items?itemName=AmazonWebServices.amazon-q-vscode
Apache License 2.0
1.49k stars 418 forks source link

fix: unreliable test "transformByQ WHEN update job history..." #5135

Closed justinmk3 closed 3 months ago

justinmk3 commented 3 months ago

Problem:

unreliable test:

  1 failing
  1) transformByQ
       WHEN update job history called THEN returns details of last run job:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly deep-equal:
+ actual - expected ... Lines skipped

  {
    'abc-123': {
+     duration: '2 sec',
-     duration: '0 sec',
      projectName: 'test-project',
...
      status: 'COMPLETED'
    }
  }
      + expected - actual

       {
         "abc-123": {
      -    "duration": "2 sec"
      +    "duration": "0 sec"
           "projectName": "test-project"
           "startTime": "05/03/24, 11:35 AM"
           "status": "COMPLETED"
         }

      at Context.<anonymous> (d:\a\aws-toolkit-vscode\aws-toolkit-vscode\packages\core\src\test\codewhisperer\commands\transformByQ.test.ts:182:16)

Solution:

Use a narrower assertion. The important property is still tested, the other properties are not relevant for this test.

fix https://github.com/aws/aws-toolkit-vscode/issues/5134

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.