OSD600_Release 0.1
In my OSD600 Release 0.1 (and lab 2), I have added a test in
filerjs. Filer is an open source project. https://github.com/filerjs/filer
I am new with git and GitHub, so it was some difficulty for me to complete this assignment. First, I needed to set up git and GitHub and learned the
process to use them to file and fix a bug in open source. After that, I
created a fork and cloned forked repo to download all the filer code to my own
local machine. On my computer (command line git), I added remote named “upstream”
for the original repo. Then, I found and created an Issue on GitHub. As many
students in the class, writing a unit test is maybe better for me as the
beginner working with git and GitHub. Next, I checkout a branch, made code
change, run and tested them, added and committed on my branch, pushed my commit
and created a Pull Request.
For more information about the process, click here https://wiki.cdot.senecacollege.ca/wiki/DPS909_%26_OSD600_Fall_2018
Filing an Issue
I have created an Issue #435: add a test for
fsPromise.unlink() to delete a file that does not exist. I want to write this
unit test with Promise function to test whether it will return an error when someone
wants to delete a file when it doesn’t exist.
Linking to my Pull Request
I searched the Pull Request on GitHub to find the similar
logic code. After that, I copied and made changes on it to fix my fsPromise.unlink() test.
My test was added into the following path filer/tests/spec/fs.unlink.spec.js.
First, I wanted to delete a file called myFile that doesn’t exist, and then it
could not success and catch for the error and promise will return an error.
Another student (y2s82) reviewed my issue and gave me some
comment on how to make code more promise-friendly. I made those changes and
pushed them again on GitHub.
My Pull Request: Fix #435: add a test for fsPromise.unlink() to delete a file that doesn't exist
/**
* fsPromises tests
*/
describe('fsPromises.stat', function() {
beforeEach(util.setup);
afterEach(util.cleanup);
it('should return an error if trying to delete a file that does not
exist', function() {
var fsPromises = util.fs().promises;
return fsPromises.unlink('/myFile')
.then(result => expect(result).not.to.exist)
.catch(error => {
expect(error).to.exist;
expect(error.code).to.equal('ENOENT');
});
});
});
Linking to peer review
I reviewed this pull request of my classmate. Fixed #424 - implement fs.promises.read tests #429
He tried to write a set of test for fs.promises.read() to
test whether the function returns promise object. It was a great work for him to test all the use cases. I have had some comments to ask if
he can remove the catch(error) lines. He can open the file, then write to it
and return the promise object, so he doesn’t need to catch for error here. This
will be same if he can read from the file and return the promise object, so he
doesn’t need to catch for error.
Asking for help
I did not help any student because I am new and lack of
experience with git and GitHub. Therefore, I got help from my classmate (Jeffrey
Espiritu). When I am not sure with any git command lines, I will confirm with
him whether it is right or wrong. He helped me a lot and I am appreciated about
it. Also, as I said above, I had a code review and gave some comments and I
hope they are helpful.
Comments
Post a Comment