Skip to content

Improve survey notification unit tests - #26316

Open
Amar verma (AmarVerma99) wants to merge 1 commit into
microsoft:mainfrom
AmarVerma99:fix/improve-survey-notification-tests
Open

Amar verma (AmarVerma99) wants to merge 1 commit into
microsoft:mainfrom
AmarVerma99:fix/improve-survey-notification-tests

Conversation

@AmarVerma99

Copy link
Copy Markdown

Fixes #24906

Summary

Refactors src/test/activation/extensionSurvey.unit.test.ts to reduce mocking and test real behavior:

  • Replaced TypeMoq and ts-mockito mocks for PersistentStateFactory, IPersistentState, and WorkspaceConfiguration with the real PersistentStateFactory backed by MockMemento and MockWorkspaceConfiguration.
  • Replaced TypeMoq mocks for IApplicationShell, IBrowserService, IRandom, IExperimentService, IApplicationEnvironment, IPlatformService, and IWorkspaceService with lightweight plain-object doubles and sinon boundary stubs.
  • Removed sinon.stub(ExtensionSurveyPrompt.prototype, ...) self-stubbing and real sleep() calls in activate() tests in favor of sinon.useFakeTimers(), exercising the real activate() → shouldShowBanner() → showSurvey() flow.
  • Added test coverage for UIKind.Web, temporary disable period expiry (12 weeks), and missing telemetry config / unset feedback.enabled defaulting to true.

Testing

  • npx tsc -p ./ — passed
  • npx mocha -r out/test/unittests.js --ui tdd "out/test/activation/**/*.unit.test.js" — 75 passing (17 in Extension survey prompt)
  • npx eslint src/test/activation/extensionSurvey.unit.test.ts — passed
  • npx prettier --check src/test/activation/extensionSurvey.unit.test.ts — passed
  • git diff --check — passed
@AmarVerma99

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant