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

Fixed issue#480 using promises to test fs.truncate when path does not exist #516

Merged
merged 2 commits into from Oct 9, 2018

Conversation

Projects
None yet
2 participants
@ooHAoo
Copy link
Contributor

commented Sep 25, 2018

Fixes #480 - Add a test for truncate when path does not exist using promises.

I attempted to add a test for when fs.truncate is being passed a path/file that does not exist.
This was all done using promises.

@humphd
Copy link
Contributor

left a comment

Looks pretty good @ooHAoo. I've left some things to address. Thanks for adding this test.

describe('fsPromises.truncate', function () {
beforeEach(util.setup);
afterEach(util.cleanup);
it('should error when path does not exist (with promises)', (done) => {

This comment has been minimized.

Copy link
@humphd

humphd Sep 25, 2018

Contributor

You can get rid of done in this callback

it('should error when path does not exist (with promises)', (done) => {
var fsPromises = util.fs().promises;

fsPromises.truncate('/NonExistingPath', 0)

This comment has been minimized.

Copy link
@humphd

humphd Sep 25, 2018

Contributor

Add a return before the fsPromises... here, so you return the Promise for this test, to signal it's done.

var fsPromises = util.fs().promises;

fsPromises.truncate('/NonExistingPath', 0)
.then(result => expect(result).not.to.exist)

This comment has been minimized.

Copy link
@humphd

humphd Sep 25, 2018

Contributor

I think you can delete this line.

@humphd

humphd approved these changes Oct 9, 2018

@humphd humphd merged commit 2e2e2f9 into filerjs:master Oct 9, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.