Files
superset2/superset/assets/spec/javascripts/components/CachedLabel_spec.jsx
Maxime Beauchemin 787daf6005 A nice CacheLabel React component (#2628)
Introducing a nice component as a label that show when data was
loaded from cache, when the cache was taken (in humanize duration as in
`a few minutes ago`) in a tooltip, and it can act as a button that
can trigger a force-refresh.

While working on it, it became clear that it was going to be hard to
use this component in the Dashboard view since it's not pure React.
I'm planning on refactoring the dashboard view with proper React/Redux
and introducing the CachedLabel component at that point.

While digging around in the Dashboard view I realized that there was a
bunch on unused code around managing timers that was used in explorev1
and decided to rip it out.
2017-04-17 09:06:56 -07:00

27 lines
655 B
JavaScript

import React from 'react';
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { shallow } from 'enzyme';
import { Label } from 'react-bootstrap';
import CachedLabel from '../../../javascripts/components/CachedLabel';
describe('CachedLabel', () => {
const defaultProps = {
onClick: () => {},
cachedTimestamp: '2017-01-01',
};
it('is valid', () => {
expect(
React.isValidElement(<CachedLabel {...defaultProps} />),
).to.equal(true);
});
it('renders', () => {
const wrapper = shallow(
<CachedLabel {...defaultProps} />,
);
expect(wrapper.find(Label)).to.have.length(1);
});
});