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
add tests to check missionsCompleted7Days value is in required range #31
Comments
This issue is still available for first-time contributorsThe commits listed above and just below this message are for a different issue |
…(testing randomMissionsCompleted function)
Go for it @sblasa! Thank you 🙇 |
@TalAter Thanks! 😄 |
Hey @sblasa, how is it going with this one? Do you need any help with it? |
@TalAter Hi! Sorry, got busy with work. Starting on it today. Thanks for the reminder! :) |
@TalAter I'm getting this error when I run the npm test. I followed directions noted above description. C:\Users\stbla\code_school\opensource\missioncontrol [master ≡ +0 ~2 -0 !]> npm test
[08:12:49] Using gulpfile ~\code_school\opensource\missioncontrol\gulpfile.js TypeError: Cannot read property 'forEach' of undefined |
Hmmm. I cannot reproduce this on my machine and there is nothing specific about Mission Control code in the error. My guess would be it has something to do with the script trying to access the filesystem in an environment that isn't unix-like. Are you using the standard/old school command shell of Windows? If you are using Windows 10, I would try using the new bash-like shell they offer. If you are in an older version I know I used to use cygwin back in my Windows days, but there may be better solutions these days. I know this may seem like a lot of hoops to jump for just to send a PR for this project, but I think it is worth it because this has far reaching consequences for most open source projects you'll work with. |
@TalAter Hi, yes, I tried using Git Bash, and that didn't work as well. I'm going to redo the repo on my machine and run it again. I will keep trying! :) Thanks! |
@TalAter Hi, I figured out that I needed to do a pull from the original repo and merge it with my project. I had noticed that there were some file changes in the original missioncontrol that I didn't have. It's working now. Moving on to fix the issue at hand. :) |
@TalAter , so I'm looking at the est/specs/simulation.random.spec.js . There is a describe block in there already, but I needed some help. I added the test in bold below and it passed. However, I need to add a test to see if the missionsCompleted7Days is a positive integer. Could you tell me how I could add that to the test? Thanks! describe('randomMissionsCompleted()', () => { test('returns an object', () => { test('returns an object containing missionsCompleted7Days which is less than or equal to missionsCompleted', () => { test('returns an object containing missionsCompleted which is an integer between 4 and 90', () => { }); |
Hey @sblasa, |
Thanks @Rob-Rychs @sblasa does that answer your question? GitHub Pro Tip #3704: When entering code in these GitHub issues, it is best to use markdown to make it easier to read... You even get syntax highlighting for free with it: Just surround your code with some backticks like so: describe('randomMissionsCompleted()', () => {
test('returns an object', () => {
expect(
typeof randomMissionsCompleted()
).toBe('object');
});
}); |
@TalAter Ah, thanks for the tip! I was wondering how I would do that. 👍 I'm going to try out the code that Rob-Rychs mentioned. |
@TalAter The code passed when I ran the test. I added this code test('returns an object containing missionsCompleted7Days which is less than or equal to missionsCompleted', () => {
expect(
randomMissionsCompleted().missionsCompleted7Days
).toBeLessThanOrEqual(randomMissionsCompleted().missionsCompleted);
});
test('returns an object containing missionsCompleted7Days which is an integer', () => {
expect(
Number.isInteger(randomMissionsCompleted().missionsCompleted7Days)
).toBeTruthy();
});
test('returns an object containing missionsCompleted7Days which is a positive number', () => {
expect(
randomMissionsCompleted().missionsCompleted7Days
).toBeGreaterThan(0);
}); What do you think? Thanks for your help! |
|
Good stuff @sblasa @TalAter test('returns an object containing missionsCompleted7Days which is less than or equal to missionsCompleted', () => {
const prop = randomMissionsCompleted();
expect(
prop.missionsCompleted7Days
).toBeLessThanOrEqual(prop.missionsCompleted);
}); ` |
@TalAter thanks! Those are good points. I will change the format of that and change the conditions. @Rob-Rychs, that sounds like a good idea. I will try that too. Thank you you both for being very supportive. :) I will implement this tonight. |
…less than or equal to missionsCompleted test
@sblasa Are you still interested in working on this issue? We have received another pull request for it by @JordanShaak |
@TalAter @Rob-Rychs Yes, I finished the update yesterday, and I was just going back through steps on Pull Request. I am submitting the pull request. Thanks! :) |
Issue #31 add tests to check missionsCompleted7Days value is in required range Issue
🎊 Just merged it. Awesome! Congratulations on being an open sourcerer, and thank you so much for taking the time to help build the project! |
@TalAter @Rob-Rychs Thanks for all your help! I'll keep an eye out for any other issues that I can help with. :) |
first-timers-only
This issue is tagged first-timers-only. It is only for people who have never contributed to open source before, and are looking for an easy way take their first steps.
Consider this your chance to dip your toe into the world of open-source, and get some bragging rights for writing code that makes drones fly, lets cars find charging stations, helps people and goods get from place to place, and more.
Find more first-timers-only issues here:
Thank you for your help ❤️
What is this project?
DAV (Decentralized Autonomous Vehicles) is a new foundation working to build an open-source infrastructure for autonomous vehicles (cars, drones, trucks, robots, and all the service providers around them) to communicate and transact with each other over blockchain.
As an organization that believes in building a large community of open-source contributors, we often create issues like this one to help people take their first few steps into the world of open source.
Mission Control
The DAV project you are looking at is Mission Control. It is the brain in charge of orchestrating missions between DAV users and autonomous vehicles.
How you can help
Background
To help developers building on top of DAV technologies, Mission Control can start in a simulation environment. In a simulation environment, there are always a few simulated drones flying around the user, ready to take on missions. This makes it easy for developers to start building and testing without investing in hardware.
The Issue
As a project that relies on a large community of contributors, it is very important for us to have good tests to make sure changes don't break anything.
One of the functions that need testing is
randomMissionsCompleted()
inside /server/simulation/random.js that creates random number ofmissionsCompleted
andmissionsCompleted7Days
.The task for this issue is to test the functions return value.
Edit
test/specs/simulation.random.spec.js
, adding adescribe
block forrandomMissionsCompleted()
if it does not exists and within it one test that verify the condition mentioned above.To run your tests, run
npm test
from the project's root directory. All tests should pass.Contributing to Mission Control
$ git clone git@github.com:YOUR-GITHUB-USER-NAME/missioncontrol.git
$ cd missioncontrol; npm install
npm test
to run linting checks and all the automated tests and see that they pass.npm test
one last time and make sure no errors (including linting errors) are thrown.$ git push -u origin master
#30
)The text was updated successfully, but these errors were encountered: