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 unit tests for table comment #2098

Merged
merged 1 commit into from Jun 10, 2017

Conversation

Projects
None yet
2 participants
@rizip1
Contributor

rizip1 commented Jun 3, 2017

I created tests to add table comment. These are for postgresql, mysql and oracle as it seems to me that .comment() function is not supported for sqlite.
I test setting the comment and setting it back to empty string. I assume that many users will expect that .comment(null) or simply .comment() will work the same as .comment('') I also made tests for these cases. However .comment(null) and .comment() does not work that way in mysql so these tests are only for postgresql and oracle.

expect(tableSql[0].sql).to.equal('comment on table "users" is \'\'');
});
it('test set empty comment using null', function() {

This comment has been minimized.

@elhigu

elhigu Jun 9, 2017

Collaborator

I wouldn't consider setting comment to be empty string by setting it to null or undefined as a intended behaviour. So better to not add test for that functionality, since better test would be throwing an error because of invalid parameter.

@elhigu

Thanks for tests! They look fine, except that none of the dialects should have tests that .comment with undefined / null / falsy param sets empty string comment. Invalid parameters should throw an error (any parameter that is not string).

So please delete those tests setting comments with non-string arguments and I can merge this.

@rizip1

This comment has been minimized.

Contributor

rizip1 commented Jun 10, 2017

Ok I deleted those non-string args tests and rebased.

Add unit tests for table comment
* Tests for setting comment on table for postgresql, mysql and oracle

* No tests for sqlite as it does not seem to support comments

* No tests for mssql as it can not be tested simply using sql comparison
@elhigu

elhigu approved these changes Jun 10, 2017

@elhigu elhigu merged commit e63fe22 into tgriesser:master Jun 10, 2017

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