explorer.test.js 1023 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import { expect } from 'chai';
  3. import { shallow } from 'enzyme';
  4. import '../stubs';
  5. import Explorer from '../../src/components/explorer/Explorer';
  6. import ExplorerItem from '../../src/components/explorer/ExplorerItem';
  7. describe('Explorer', () => {
  8. it('exists', () => {
  9. // eslint-disable-next-line no-unused-expressions
  10. expect(Explorer).to.exist;
  11. });
  12. describe('ExplorerItem', () => {
  13. const props = {
  14. data: {
  15. meta: {
  16. children: {
  17. count: 0,
  18. }
  19. }
  20. },
  21. };
  22. it('exists', () => {
  23. // eslint-disable-next-line no-unused-expressions
  24. expect(ExplorerItem).to.exist;
  25. });
  26. it('has item metadata', () => {
  27. expect(shallow(<ExplorerItem {...props} />).find('.c-explorer__meta')).to.have.lengthOf(1);
  28. });
  29. it('metadata contains item type', () => {
  30. expect(shallow(<ExplorerItem {...props} typeName="Foo" />).find('.c-explorer__meta').text()).to.contain('Foo');
  31. });
  32. });
  33. });