Skip to content

test: add integration tests for token storage #7500

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

Merged
merged 8 commits into from
Jul 4, 2025

Conversation

simeng-li
Copy link
Contributor

Summary

This PR includes the following updates:

  1. Update the mock-social-connector to support token storage
  2. Update the GitHub interaction test action to include the SECRET_VAULT_KEK env variable.
  3. Split the original social sign-in interaction API integration tests for a better test case structure.
  4. Update the social sign-in interaction test cases to include token storage. Test the social connector authentication with the token secret storage enabled flow.

Testing

integration test

Checklist

  • .changeset
  • unit tests
  • integration tests
  • necessary TSDoc comments

@simeng-li simeng-li requested review from darcyYe and gao-sun as code owners July 2, 2025 08:28
@simeng-li simeng-li requested review from a team and charIeszhao and removed request for a team July 2, 2025 08:28
Copy link

github-actions bot commented Jul 2, 2025

COMPARE TO master

Total Size Diff 📈 +4 KB

Diff by File
Name Diff
.github/workflows/alteration-compatibility-integration-test.yml 📈 +157 Bytes
.github/workflows/integration-test.yml 📈 +157 Bytes
packages/connectors/connector-mock-social/src/constant.ts 📈 +33 Bytes
packages/connectors/connector-mock-social/src/index.ts 📈 +963 Bytes
packages/integration-tests/src/api/admin-user.ts 📈 +244 Bytes
packages/integration-tests/src/api/connector.ts 📈 +65 Bytes
packages/integration-tests/src/helpers/experience/index.ts 📈 +82 Bytes
packages/integration-tests/src/tests/api/connector.test.ts 📈 +85 Bytes
packages/integration-tests/src/tests/api/experience-api/profile/social-fullfill-user-profiles.test.ts 📈 +7.83 KB
packages/integration-tests/src/tests/api/experience-api/sign-in-interaction/social.test.ts 📈 +5.58 KB

@simeng-li simeng-li requested a review from Copilot July 2, 2025 08:28
@simeng-li simeng-li changed the title test: add integration tests for token storage test: add integration tests for token storage Jul 2, 2025
@github-actions github-actions bot added size/xl and removed size/xl labels Jul 2, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces token storage support in the social authentication flow by extending the mock connector, updating APIs and helpers, and enhancing integration tests and workflows.

  • Extend mock-social-connector to return and validate token responses
  • Update API and helper signatures to enable token storage and retrieve stored tokens
  • Enhance integration tests and CI workflows to set up and verify token storage

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/connectors/connector-mock-social/src/index.ts Add getTokenResponseAndUserInfo and session validation for token storage
packages/connectors/connector-mock-social/src/constant.ts Mark connector metadata with isTokenStorageSupported: true
packages/integration-tests/src/api/connector.ts Extend updateConnectorConfig to accept enableTokenStorage and syncProfile
packages/integration-tests/src/api/admin-user.ts Add getUserIdentityTokenSetRecord to fetch stored token sets
packages/integration-tests/src/helpers/experience/index.ts Extend signInWithSocial helper signature to include tokenResponse
packages/integration-tests/src/tests/api/experience-api/sign-in-interaction/social.test.ts Update social sign-in tests to enable and assert token storage
packages/integration-tests/src/tests/api/experience-api/profile/social-fullfill-user-profiles.test.ts Add dedicated tests for fulfilling missing user profiles
packages/integration-tests/src/tests/api/connector.test.ts Adapt connector config tests to the new updateConnectorConfig signature
.github/workflows/integration-test.yml Add SECRET_VAULT_KEK environment variable
.github/workflows/alteration-compatibility-integration-test.yml Add SECRET_VAULT_KEK environment variable
Comments suppressed due to low confidence (1)

packages/connectors/connector-mock-social/src/index.ts:101

  • Reference to randomUUID is used without importing it. Add import { randomUUID } from 'crypto'; at the top of this file.
      id: userId ?? `mock-social-sub-${randomUUID()}`,

@github-actions github-actions bot added size/xl and removed size/xl labels Jul 2, 2025
@simeng-li simeng-li force-pushed the simeng-log-11665-integration-test branch from 93ce80a to 91f7970 Compare July 2, 2025 08:54
@simeng-li simeng-li requested a review from wangsijie as a code owner July 2, 2025 08:54
@simeng-li simeng-li force-pushed the simeng-log-11665-token-storage-integration-test branch from 7315824 to 025f1ed Compare July 2, 2025 08:55
@github-actions github-actions bot added size/xl and removed size/xl labels Jul 2, 2025
Base automatically changed from simeng-log-11665-integration-test to master July 3, 2025 05:57
@github-actions github-actions bot added size/xl and removed size/xl labels Jul 3, 2025
simeng-li added 3 commits July 3, 2025 13:59
add SECRET_VAULT_KEK env variable for integration test ci job
update mock social connector to support token storage
add integration test for token storage
clean up unused code
@simeng-li simeng-li force-pushed the simeng-log-11665-token-storage-integration-test branch from 025f1ed to 0ad8dc6 Compare July 3, 2025 05:59
@github-actions github-actions bot added size/xl and removed size/xl labels Jul 3, 2025
@darcyYe
Copy link
Contributor

darcyYe commented Jul 3, 2025

what does SECRET_VAULT_KEK stand for?

add comments
@github-actions github-actions bot added size/xl and removed size/xl labels Jul 3, 2025
@simeng-li
Copy link
Contributor Author

what does SECRET_VAULT_KEK stand for?

key encryption key

hardcode secret_vault_kek in the integration test ci job
@github-actions github-actions bot added size/xl and removed size/xl labels Jul 4, 2025
Copy link
Member

@gao-sun gao-sun left a comment

Choose a reason for hiding this comment

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

LGTM on CI updates

simeng-li and others added 2 commits July 4, 2025 11:30
@github-actions github-actions bot added size/xl and removed size/xl labels Jul 4, 2025
@simeng-li simeng-li enabled auto-merge (squash) July 4, 2025 03:31
@github-actions github-actions bot added size/xl and removed size/xl labels Jul 4, 2025
@simeng-li simeng-li merged commit 99af87c into master Jul 4, 2025
34 checks passed
@simeng-li simeng-li deleted the simeng-log-11665-token-storage-integration-test branch July 4, 2025 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants