Skip to content

Instantly share code, notes, and snippets.

@ejcer
Last active July 28, 2016 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ejcer/280348c03d5a042c446b55b95fadaa12 to your computer and use it in GitHub Desktop.
Save ejcer/280348c03d5a042c446b55b95fadaa12 to your computer and use it in GitHub Desktop.
ItemComponent.js
/* globals React */
const shallow = require('enzyme').shallow;
const expect = require('chai').expect;
const setup = require('static/bundles/test/componentSetup');
const courseViewGradeData = require('static/bundles/ondemand/components/__fixtures__/CourseViewGrade.mock');
const courseMaterialData = require('static/bundles/author-grade/stores/__tests__/fixtures/courseMaterialData.newGradeWeights.js');
const beforeEachLoadPromisedObject = require('static/bundles/phoenix/test/lib/beforeEachLoadPromisedObject');
describe.only('ItemComponent', () => {
setup();
let wrapper;
let ItemComponent;
let itemMetadata;
beforeEachLoadPromisedObject('courseMaterials', 'pages/open-course/common/singletons/courseMaterials');
const basePropData = {
itemMetadata: this.courseMaterials.getModules().first().getLessons().first().getItemMetadatas().first();,
itemGrade: courseViewGradeData
};
before(() => {
beforeEachLoadPromisedObject('courseMaterials', 'pages/open-course/common/singletons/courseMaterials');
itemMetadata = this.courseMaterials.getModules().first().getLessons().first().getItemMetadatas().first();
console.log(this.itemMetadata);
console.log('safljahsdlfkjhasldkfjha=====================================');
ItemComponent = environment.require('bundles/ondemand/components/moduleLessons/ItemComponent');
wrapper = shallow(<ItemComponent {...basePropData} />);
});
describe('should display lockedness', () => {
it('with an icon and a tooltip', () => {
console.log('safljahsdlfkjhasldkfjha=====================================');
console.log(itemMetadata);
const LockedTooltip = this.environment.require('bundles/ondemand/components/sessions/LockedTooltip');
const Icon = this.environment.require('bundles/iconfont/Icon');
expect(wrapper.find('Icon')).to.have.length(1);
expect(wrapper.find('LockedTooltip')).to.have.length(1);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment