Sha256: fa8b2c2d569eb3b18b7bd580610330841af698bb070e6d87a40fa54172f5d68e

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

/* global jest, describe, it, expect */

'use strict';

jest.dontMock('../time');
jest.dontMock('moment');

var React = require('react/addons');
var TestUtils = React.addons.TestUtils;
var Time = require('../time').Time;

describe('time', function() {
    it('default render', function() {
        var component = TestUtils.renderIntoDocument(
            <Time timestamp="1" />
        );

        var element = TestUtils.findRenderedDOMComponentWithTag(component, 'time');

        expect(element.getDOMNode().textContent).toEqual('Jan 1, 1970 3:00 AM');
    });

    it('time from now', function() {
        var component = TestUtils.renderIntoDocument(
            <Time timestamp="1" relative="time from now" />
        );

        var element = TestUtils.findRenderedDOMComponentWithTag(component, 'time');

        expect(element.getDOMNode().textContent).toMatch(/years ago/);
    });

    it('calendar time', function() {
        var component = TestUtils.renderIntoDocument(
            <Time timestamp="1" relative="calendar time" />
        );

        var element = TestUtils.findRenderedDOMComponentWithTag(component, 'time');

        expect(element.getDOMNode().textContent).toEqual('01/01/1970');
    });
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conjur-asset-ui-1.6.0 app/src/components/generic/__tests__/time-test.js