Socialify

Folder ..

Viewing time.spec.ts
23 lines (19 loc) • 671.0 B

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { describe, expect, it } from 'vitest';
import { faker } from '../dist/cjs';

faker.seed(1234);

describe('time', () => {
  describe('recent()', () => {
    it('returns the recent timestamp in Unix time format', () => {
      const date = faker.time.recent();
      expect(typeof date).toBe('number');
    });

    it('returns the recent timestamp in full time string format', () => {
      const date = faker.time.recent('wide');
      expect(typeof date).toBe('string');
    });

    it('returns the recent timestamp in abbreviated string format', () => {
      const date = faker.time.recent('abbr');
      expect(typeof date).toBe('string');
    });
  });
});