Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Fix date component timezone in blogging prompts unit test - #505

Merged
dvdchr merged 2 commits into
trunkfrom
feature/fix-blogging-prompts-test
May 13, 2022
Merged

Fix date component timezone in blogging prompts unit test#505
dvdchr merged 2 commits into
trunkfrom
feature/fix-blogging-prompts-test

Conversation

@dvdchr

@dvdchr dvdchr commented May 13, 2022

Copy link
Copy Markdown
Contributor

Refs wordpress-mobile/WordPress-iOS#18607 (review)

Description

Fixes an issue where unit tests for Blogging Prompts could fail locally depending on the system's timezone.


⚠️ NOTE: Auto-merge is turned on. ⚠️


Testing Details

If your timezone is behind UTC, simply run the unit tests and ensure that they pass. Especially this test case: BloggingPromptsServiceRemoteTests#test_fetchPrompts_returnsRemotePrompts.

Otherwise, you can set a temporary timezone modification in setUp and tearDown like so:

// BloggingPromptsServiceRemoteTests.swift

    override func setUp() {
        super.setUp()
        NSTimeZone.default = TimeZone(secondsFromGMT: -2 * 3600)! // Set timezone to UTC-2.
        // ...
    }

    override func tearDown() {
        super.tearDown()
        // ...
        NSTimeZone.default = NSTimeZone.system // Reset the timezone.
    }
  • Please check here if your pull request includes additional test coverage.
  • I have considered updating the version in the .podspec file.

@dvdchr dvdchr added the bug Something isn't working label May 13, 2022
@dvdchr
dvdchr requested a review from ScoutHarris May 13, 2022 20:02
@dvdchr dvdchr self-assigned this May 13, 2022
@dvdchr
dvdchr enabled auto-merge May 13, 2022 20:03
@dvdchr dvdchr changed the title Fix date components timezone Fix date component timezone in blogging prompts unit test May 13, 2022
@dvdchr
dvdchr merged commit 1c92ceb into trunk May 13, 2022

@ScoutHarris ScoutHarris left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ run the unit tests and ensure that they pass

:shipit:

@dvdchr
dvdchr deleted the feature/fix-blogging-prompts-test branch May 13, 2022 20:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants