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

Complete tests for lib/record.js #185

Merged
merged 4 commits into from
Jun 17, 2020
Merged

Conversation

rmeritz
Copy link
Contributor

@rmeritz rmeritz commented Jun 11, 2020

No description provided.

.destroy('rec123')
.then(
function() {
throw new Error('Promise unexpectly fufilled.');
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "unexpectly" -> "unexpectedly" (here and below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

test/delete.test.js Outdated Show resolved Hide resolved
expect(record.get('foo')).toBeUndefined();
expect(record.get('baz')).toEqual('qux');

expect(table._base.runAction).toHaveBeenCalledWith(
Copy link
Contributor

Choose a reason for hiding this comment

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

The invocation of _base.runAction doesn't seem particularly important for the caller. A more robust test would involve verifying that an HTTP PUT request is issued. This file sets the precedent, so good on you for finding that and sticking to it! Improving the existing tests is in-scope for our work, but I'll be satisfied if you'd rather address this in a follow-up patch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated these tests to use the same mocking we use in all other places.

function(err) {
expect(err.statusCode).toBe(402);
expect(err.message).toBe('foo bar');
done();
Copy link
Contributor

Choose a reason for hiding this comment

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

The done callback can be omitted when tests return a Promise (here and below)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

Copy link
Contributor

Choose a reason for hiding this comment

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

Digging the pun

- Remove unneeded done
- Fix spelling issue
And replace with the same mocking we use in all other files
@kasrak
Copy link
Contributor

kasrak commented Jun 17, 2020

@jugglinmike any other comments?

@jugglinmike
Copy link
Contributor

None--this looks good to me!

@kasrak kasrak merged commit 939fba5 into Airtable:master Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants