Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(unit tests): Adding additional unit tests #3291

Merged
merged 8 commits into from
Oct 24, 2023

Conversation

ruisebas
Copy link
Member

Description

This PR adds additional unit tests to the following targets:

  • AWSCognitoAuthPlugin
  • AWSStoragePlugin
  • AWSPinpointPushNotificationsPlugin

It also removes some orphaned code found around :)

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

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

@ruisebas ruisebas requested a review from a team as a code owner October 12, 2023 15:54
@ruisebas ruisebas temporarily deployed to Fortify October 12, 2023 18:34 — with GitHub Actions Inactive
@ruisebas ruisebas force-pushed the ruisebas/increase_unit_test_coverage branch from 8d13d0a to e7c7943 Compare October 12, 2023 19:55
@ruisebas ruisebas temporarily deployed to Fortify October 12, 2023 19:55 — with GitHub Actions Inactive
@codecov-commenter
Copy link

codecov-commenter commented Oct 12, 2023

Codecov Report

Merging #3291 (bcec936) into main (bdc9b4a) will increase coverage by 2.32%.
The diff coverage is 63.63%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main    #3291      +/-   ##
==========================================
+ Coverage   64.49%   66.81%   +2.32%     
==========================================
  Files        1075     1075              
  Lines       35891    35851      -40     
==========================================
+ Hits        23148    23954     +806     
+ Misses      12743    11897     -846     
Flag Coverage Δ
API_plugin_unit_test 67.07% <ø> (ø)
AWSPluginsCore 66.15% <ø> (ø)
Amplify 47.81% <ø> (-0.02%) ⬇️
Analytics_plugin_unit_test 81.37% <ø> (ø)
Auth_plugin_unit_test 74.36% <33.33%> (+0.26%) ⬆️
CoreMLPredictions_plugin_unit_test 59.44% <ø> (ø)
DataStore_plugin_unit_test 81.05% <ø> (-0.02%) ⬇️
Geo_plugin_unit_test 70.75% <ø> (ø)
Logging_plugin_unit_test 63.09% <ø> (ø)
Predictions_plugin_unit_test 37.29% <ø> (ø)
PushNotifications_plugin_unit_test 88.76% <ø> (+28.46%) ⬆️
Storage_plugin_unit_test 78.01% <100.00%> (+23.83%) ⬆️
unit_tests 66.81% <63.63%> (+2.32%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...gnitoAuthPlugin/Models/AWSAuthCognitoSession.swift 30.85% <ø> (+2.96%) ⬆️
...toAuthPlugin/Models/AWSCognitoUserPoolTokens.swift 97.43% <100.00%> (ø)
...rt/Helpers/AuthCognitoSignedOutSessionHelper.swift 30.00% <ø> (+12.60%) ⬆️
...s/AWSS3StoragePlugin/Dependency/AWSS3Adapter.swift 98.85% <100.00%> (+95.40%) ⬆️
.../AWSS3StoragePlugin/Dependency/AWSS3Behavior.swift 0.00% <ø> (ø)
...gePlugin/Service/Storage/AWSS3StorageService.swift 86.12% <100.00%> (+46.94%) ⬆️
...pport/Internal/StorageMultipartUploadSession.swift 82.83% <ø> (+8.57%) ⬆️
...ePlugin/Support/Internal/StorageTransferTask.swift 98.50% <100.00%> (+58.89%) ⬆️
.../HostedUI/HostedUIASWebAuthenticationSession.swift 0.00% <0.00%> (ø)

... and 30 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ruisebas ruisebas force-pushed the ruisebas/increase_unit_test_coverage branch from e7c7943 to b2ccaf8 Compare October 18, 2023 20:44
@ruisebas ruisebas temporarily deployed to Fortify October 18, 2023 20:44 — with GitHub Actions Inactive
@ruisebas ruisebas temporarily deployed to Fortify October 18, 2023 21:03 — with GitHub Actions Inactive
harsh62
harsh62 previously approved these changes Oct 18, 2023
thisisabhash
thisisabhash previously approved these changes Oct 18, 2023
Copy link
Member

@thisisabhash thisisabhash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor comments

import XCTest

class CognitoUserPoolASFTests: XCTestCase {
private var pool: CognitoUserPoolASF!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: rename to userPool?

//

@testable import Amplify
//@testable import func AmplifyTestCommon.XCTAssertThrowFatalError
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can remove the comment if not needed

@ruisebas ruisebas dismissed stale reviews from thisisabhash and harsh62 via bcec936 October 20, 2023 15:48
@ruisebas ruisebas force-pushed the ruisebas/increase_unit_test_coverage branch from bae48a2 to bcec936 Compare October 20, 2023 15:48
@ruisebas ruisebas temporarily deployed to Fortify October 20, 2023 15:48 — with GitHub Actions Inactive
@ruisebas ruisebas merged commit 4a796c4 into main Oct 24, 2023
76 checks passed
@ruisebas ruisebas deleted the ruisebas/increase_unit_test_coverage branch October 24, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants