Skip to content

Conversation

fabienjuif
Copy link
Member

No description provided.

@fabienjuif fabienjuif changed the title Feat #28 - wait parameter is boosted - code coverage Feat #18 - wait parameter is boosted - code coverage Sep 25, 2016
@fabienjuif
Copy link
Member Author

#18

src/index.jsx Outdated
return Boolean(wait)
}

isLoadAFunction = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete this ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

it('should call the `load` function parameter if present', () => {
// Mount
const load = spy(() => {})
const load2 = spy(() => {})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a more explicit naming ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@fabienjuif
Copy link
Member Author

@Zenika/nantes review plz plz

// Implicitly meaning that this is an array of props
if (Array.isArray(wait)) {
return wait
.map(w => Boolean(this.props[w]))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use better naming convention for variables

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// Load function is not called twice
// Graphic component is called
// Loader shouldn't be printed
load.should.have.been.called.once()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't have to call twice the line called.once(). Parenthesis are unnecessary

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// Load function is called
// Graphic component isn't printed
// Loader should be Dots
load.should.have.been.called.once()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The load.should.have.been.called.once() is unnecessary because load.should.have.been.called.twice() already test this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I let this that way

// Load function is not called twice
// Graphic component is called
// Loader shouldn't be printed
load.should.have.been.called.once
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use a function to avoid repetition

expect(loaded.find(Dots).node).to.be.undefined
}

const isLoaded = (load, loaded, CustomLoader = undefined) => {
Copy link
Member Author

@fabienjuif fabienjuif Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete = undefined
or = Dots

// Change `loaded` value
loaded.setProps({ loaded: true })

// Load function is not called twice
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move commentaries with functions

@fabienjuif fabienjuif merged commit 0d862e8 into master Oct 5, 2016
@fabienjuif fabienjuif deleted the feat-18 branch October 5, 2016 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants