当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript mockdate.reset函数代码示例

本文整理汇总了TypeScript中mockdate.reset函数的典型用法代码示例。如果您正苦于以下问题:TypeScript reset函数的具体用法?TypeScript reset怎么用?TypeScript reset使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了reset函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: it

    it('generates correcty zoned recurrences when a tzid is present', () => {
      const targetZone = 'America/New_York'
      const currentLocalDate = DateTime.local(2000, 2, 6, 11, 0, 0)
      setMockDate(currentLocalDate.toJSDate())

      const set = new RRuleSet()

      set.rrule(new RRule({
        freq: RRule.YEARLY,
        count: 4,
        dtstart: DateTime.fromISO('20000101T090000').toJSDate(),
        tzid: targetZone
      }))

      set.exdate(
        DateTime.fromISO('20010101T090000').toJSDate(),
      )

      set.rdate(
        DateTime.fromISO('20020301T090000').toJSDate(),
      )     

      expect(set.all()).to.deep.equal([
        expectedDate(DateTime.fromISO('20000101T090000'), currentLocalDate, targetZone),
        expectedDate(DateTime.fromISO('20020101T090000'), currentLocalDate, targetZone),
        expectedDate(DateTime.fromISO('20020301T090000'), currentLocalDate, targetZone),
        expectedDate(DateTime.fromISO('20030101T090000'), currentLocalDate, targetZone),
      ])

      resetMockDate()
    })
开发者ID:jkbrzt,项目名称:rrule,代码行数:31,代码来源:rruleset.test.ts

示例2: afterEach

  afterEach(() => {
    server.stop();
    jest.useRealTimers();
    MockDate.reset();

    mockConsole.log.mockClear();
    mockConsole.info.mockClear();
    mockConsole.warn.mockClear();
    mockConsole.error.mockClear();
  });
开发者ID:airdcpp-web,项目名称:airdcpp-apisocket-js,代码行数:10,代码来源:Socket.test.ts

示例3: it

  it('returns the date in the correct zone when given', () => {
    const targetZone = 'America/New_York'
    const currentLocalDate = DateTime.local(2000, 2, 6, 1, 0, 0)
    setMockDate(currentLocalDate.toJSDate())

    const d = DateTime.fromISO('20101005T110000').toJSDate()
    const dt = new DateWithZone(d, targetZone)
    expect(dt.rezonedDate()).to.deep.equal(
      expectedDate(DateTime.fromISO('20101005T110000'), currentLocalDate, targetZone)
    )

    resetMockDate()
  })
开发者ID:jkbrzt,项目名称:rrule,代码行数:13,代码来源:datewithzone.test.ts

示例4: test

test('locks out users who have not confirmed after N days if `lockoutAfter` is true', async (t) => {
  let app = new AppAcceptanceTest();
  let loginCredentials = {
    email: 'dave@example.com',
    password: '123'
  };
  await app.post('/users/auth/register', {
    data: {
      type: 'user',
      attributes: loginCredentials
    }
  });
  MockDate.set(moment().add(1, 'year').toDate());

  let { status } = await app.post('/users/auth/login', loginCredentials);
  t.is(status, 403);
  MockDate.reset();
});
开发者ID:davewasmer,项目名称:denali-auth,代码行数:18,代码来源:confirmable-test.ts

示例5: afterEach

 afterEach(() => {
   MockDate.reset(0);
 });
开发者ID:CityOfBoston,项目名称:cob-patterns,代码行数:3,代码来源:map-util.spec.ts

示例6: Date

import * as mockdate from 'mockdate';

mockdate.set(new Date());
mockdate.set('2017-01-05');
mockdate.set(new Date().getTime());

mockdate.set(new Date(), 0);

mockdate.reset();
开发者ID:AbraaoAlves,项目名称:DefinitelyTyped,代码行数:9,代码来源:mockdate-tests.ts


注:本文中的mockdate.reset函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。