Skip to content

Commit

Permalink
Add tests for ExampleWork and ExampleWorkBubble component
Browse files Browse the repository at this point in the history
  • Loading branch information
bgandhi001 committed Oct 17, 2018
1 parent fe7daaf commit 3de8e14
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
46 changes: 46 additions & 0 deletions __tests__/test-example-work.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import React from 'react';
import { shallow } from 'enzyme';
import ExampleWork, { ExampleWorkBubble } from '/Users/u0174059/Documents/code/bg-portfolio/js/example-work.js';


import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });

const myWork = [
{
'title': "AWS Cloud Project Example",
'image': {
'desc': "example screenshot of a project involving code",
'src': "images/example1.png",
'comment': ""
}
},
{
'title': "Prod-DR work Example",
'image': {
'desc': "example screenshot of a project involving chemistry",
'src': "images/example2.png",
'comment': ""
}
}
];

describe("ExampleWork component", () => {
let component = shallow(<ExampleWork work={myWork}/>);

it("Should be a 'section' element", () => {
except(component.type()).toEqual('section');

});
});

describe("ExampleWorkBubble component", () => {
let component = shallow(<ExampleWorkBubble example={myWork[1]}/>);

let images = component.find("img");

it("SHould contain a single 'img' element", () => {
expect(images.length).toEqual(1);
})
});
3 changes: 3 additions & 0 deletions babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["react","env"]
}

0 comments on commit 3de8e14

Please sign in to comment.