Fix bad comparison due to timezone mismatch (#1627)

## Description

Exchange stores start/end times for events in UTC time. This fixes test failures due to comparing hours extracted from time structs directly. Without the normalization to UTC, the initial time may be different.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [x] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [x] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

* closes #1625 

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x]  Unit test
- [ ] 💚 E2E
This commit is contained in:
ashmrtn 2022-11-29 09:51:34 -08:00 committed by GitHub
parent cc35088be1
commit 1d977105c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,7 +26,9 @@ func TestEventSuite(t *testing.T) {
// TestEventInfo verifies that searchable event metadata // TestEventInfo verifies that searchable event metadata
// can be properly retrieved from a models.Eventable object // can be properly retrieved from a models.Eventable object
func (suite *EventSuite) TestEventInfo() { func (suite *EventSuite) TestEventInfo() {
initial := time.Now() // Exchange stores start/end times in UTC and the below compares hours
// directly so we need to "normalize" the timezone here.
initial := time.Now().UTC()
now := common.FormatTimeWith(initial, common.M365DateTimeTimeZone) now := common.FormatTimeWith(initial, common.M365DateTimeTimeZone)
suite.T().Logf("Initial: %v\nFormatted: %v\n", initial, now) suite.T().Logf("Initial: %v\nFormatted: %v\n", initial, now)