forked from splendo/HeartstoneAssessment
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request splendo#8 from corrado4eyes/corrado/tests
Corrado/tests
- Loading branch information
Showing
11 changed files
with
133 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import App from '../src/App'; | ||
import {shallow, ShallowWrapper} from 'enzyme' | ||
import { dummyCardArray } from './__mocks__/mockObjects'; | ||
import Card from '../src/model/card'; | ||
|
||
|
||
describe('App', () => { | ||
const cards: Card[] = dummyCardArray | ||
it('renders n elements in an array', () => { | ||
const component: ShallowWrapper = shallow(<App/>); | ||
component.setState({cards: cards}) | ||
const divs: ShallowWrapper = component.find('.card'); | ||
expect(divs).toHaveLength(cards.length); | ||
}); | ||
|
||
it('Snapshot testing', () => { | ||
const component: ShallowWrapper = shallow(<App/>); | ||
component.setState({cards: cards}) | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import Card from "../../src/model/card"; | ||
|
||
export const dummyCard: Card = { | ||
artist: "Corrado Quattrocchi", | ||
cardId: "what a dummy card!", | ||
cardSet: "Dummy", | ||
collectible: true, | ||
cost: 9999, | ||
faction: "Splendo", | ||
flavor: "Meat", | ||
howToGet: "Ask Frits", | ||
howToGetGold: "Feeds and Walk Frits for 2 years every day (excluded the holidays)", | ||
img: "http://media.services.zam.com/v1/media/byName/hs/cards/enus/DS1_183.png", | ||
imgGold: "http://media.services.zam.com/v1/media/byName/hs/cards/enus/animated/DS1_183_premium.gif", | ||
locale: "enUS", | ||
name: "corrado4eyes", | ||
playerClass: "Human", | ||
rarity: "Super Rare", | ||
text: "A dummy Italian boy", | ||
type: "Developer" | ||
} | ||
|
||
export const dummyCardArray = [dummyCard] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`App Snapshot testing 1`] = ` | ||
<Fragment> | ||
<div | ||
className="card" | ||
key="what a dummy card!" | ||
> | ||
corrado4eyes | ||
</div> | ||
</Fragment> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import React from 'react'; | ||
import App from '../src/App'; | ||
import {shallow, ShallowWrapper} from 'enzyme' | ||
import { dummyCardArray } from './__mocks__/mockObjects'; | ||
import Card from '../src/model/card'; | ||
|
||
|
||
describe('App', () => { | ||
const cards: Card[] = dummyCardArray | ||
it('renders n elements in an array', () => { | ||
const component: ShallowWrapper = shallow(<App/>); | ||
component.setState({cards: cards}) | ||
const divs: ShallowWrapper = component.find('.card'); | ||
expect(divs).toHaveLength(cards.length); | ||
}); | ||
|
||
it('Snapshot testing', () => { | ||
const component: ShallowWrapper = shallow(<App/>); | ||
component.setState({cards: cards}) | ||
expect(component).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import "reflect-metadata"; | ||
import Enzyme from "enzyme"; | ||
import Adapter from "enzyme-adapter-react-16"; | ||
|
||
Enzyme.configure({ adapter: new Adapter() }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters