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

Add test for useLocalizeDate #2588

Open
compulim opened this issue Nov 12, 2019 · 0 comments
Open

Add test for useLocalizeDate #2588

compulim opened this issue Nov 12, 2019 · 0 comments
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. feature-request Azure report label technical-debt Improve maintenance, follow best practices, test coverage, etc.

Comments

@compulim
Copy link
Contributor

Feature Request

Description

While we are adding the useLocalizeDate hook, we found out we didn't test getLocaleString function at all.

But when we try to add the test, we are hitting timezone problem. Timezone of the CI box and local box could be different.

To mitigate the problem, we need to add some code in production codebase to allow the user to select timezone. For example, the options passed to Intl.DateTimeFormat should have { timeZone: 'utc' }.

Instead of doing it in the PR, we are adding a new issue and address it later.

Actual code

import { timeouts } from '../constants.json';

// selenium-webdriver API doc:
// https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/index_exports_WebDriver.html

jest.setTimeout(timeouts.test);

test('calling localizeDate should return a localized date time string', async () => {
  const { pageObjects } = await setupWebDriver();

  await expect(
    pageObjects.runHook('useLocalizeDate', [new Date(2000, 0, 2, 12, 34, 56)])
  ).resolves.toMatchInlineSnapshot(`"January 02, 20:34"`);
});

[Enhancement]

@compulim compulim added Enhancement customer-reported Required for internal Azure reporting. Do not delete. Bot Services Required for internal Azure reporting. Do not delete. Do not change color. and removed Bot Services Required for internal Azure reporting. Do not delete. Do not change color. customer-reported Required for internal Azure reporting. Do not delete. labels Nov 12, 2019
@corinagum corinagum added backlog Out of scope for the current iteration but it will be evaluated in a future release. and removed Pending labels Nov 13, 2019
@corinagum corinagum added feature-request Azure report label technical-debt Improve maintenance, follow best practices, test coverage, etc. and removed Enhancement labels Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Out of scope for the current iteration but it will be evaluated in a future release. feature-request Azure report label technical-debt Improve maintenance, follow best practices, test coverage, etc.
Projects
None yet
Development

No branches or pull requests

2 participants