Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segregate the tests and add mock responses and corresponding helper functions #47

Merged
merged 55 commits into from
Dec 9, 2019

Conversation

LakshSingla
Copy link
Member

PR authors: Laksh Singla

Please describe your PR:

This PR aims to improve upon the current state of tests by segregating the tests into Unit Tests and Integration Tests. Moreover, the required responses will be mocked for unit tests. Further extension will allow these mocks to update with the help of a script.

Reviewers: Aman Dwivedi, Yo Yehudi

Review checklist:

@LakshSingla LakshSingla changed the title (WIP) Segregate the tests and add mock responses and corresponding helper functions Segregate the tests and add mock responses and corresponding helper functions Jul 8, 2019
Copy link
Member

@yochannah yochannah left a comment

Choose a reason for hiding this comment

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

a few tiny inline comments here, but nothing big.

It might be nice to define the bundles and meta files in the test readme as well.

Ideally this should pass on travis before we merge, and #54 should be fixed (but it sounds like @amand1996 has this in hand!)
Overall the style looks great.

Gruntfile.js Show resolved Hide resolved

{service, olderEmployees} = new Fixture()

describe 'ID constraints', ->

# MOCK HERE
Copy link
Member

Choose a reason for hiding this comment

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

Is this a todo?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I should remove this

@@ -173,7 +174,8 @@ testIDResolutionAgainst = (service, extraTests = {}) ->
job.decay.should.be.above 50
return undefined

describe 'Service', ->
# BOTH (uses above function, mock accordingly)
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what this means, sorry - could you clarify?

Copy link
Member Author

Choose a reason for hiding this comment

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

So the test used the function defined above (which was a standalone function). Therefore I added this in case if anyone added mock inside the function, that it would affect the corresponding test too.

it 'should have the expected fields for Employee', (done) ->
promise.then null, done
promise.then (sfs) ->
sfs.Employee.should.eql expected
done()
return undefined

# BOTH
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, q: why is this file #BOTH when others have a method bothTests() instead?

Copy link
Member Author

@LakshSingla LakshSingla Aug 21, 2019

Choose a reason for hiding this comment

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

So the tests run as both integration as well as unit tests, I forgot to add the bothTests() annotation. bothTest() returns true always, so it doesn't make a difference. It was added for consistency with other tests and an off chance that we need to change the default behavior when both tests should run. Thanks for pointing this out!!

@yochannah
Copy link
Member

booo, travis sucks right now. so long as it passes test locally we can merge even if it's not great on travis. That travis error is happening everywhere interminey, not just imjs. It's definitely not imjs's fault.

yochannah
yochannah previously approved these changes Sep 27, 2019
@heralden heralden merged commit b2292df into intermine:dev Dec 9, 2019
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.

None yet

3 participants