- Notifications
You must be signed in to change notification settings - Fork 182
add explicit typecasts to pattern matching #255
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 explicit typecasts to pattern matching #255
Conversation
Can one of the admins verify this patch? To accept patch and trigger a build add comment ".ok\W+to\W+test." |
Can one of the admins verify this patch? |
2 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
@ptrblgh Thank you for the contribution. Could you also add some unit tests to prevent future regression? Also please sign the |
@ptrblgh Any updates on adding some test cases with this patch? |
Not yet, I'm stuck right now to make the test fail but working on it. |
Not sure what you mean. Are you having difficulties writing the test case? Here is a quick example of one case: postgresDs.automigrate(function(err, result) { if (err) throw err; Expense.create([ { Description: 'Expense 1', Amount: 12, Stamp: '1999-01-08 12:25:00', }, ], function(err, result) { if (err) throw err; Expense.find({where: {Stamp: {like: '1999%'}}}, function(err, result) { if (err) throw err; console.log('Result: ' + JSON.stringify(result)); }); }); Please note this is just the use case, you need to have |
@ptrblgh Any updates on adding the test cases? |
@ssh24 Sorry for the delay. I have added tests for this patch. |
@ptrblgh Thank you. I will be looking into it soon. Could you please rebase your branch and fix your commit linter? Rules for commit messages:
You could also give me access to handle the rebase/commit fixing by clicking |
No problem, allow granted. 👍 |
4ec27a6
to e06e1f1
Compare Thank you. Code rebased. Also PR looks good to me. Brilliant! 👍 @slnode test please |
test/postgresql.test.js Outdated
title: 't2', | ||
content: 'T2_TheOtherCase', | ||
}]); | ||
PostWithDate.create([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ptrblgh There is an issue here. Since the functions are async, it does not work like that and hence the tests are failing. You need to do something like this:
Post.create([...], function(err, result) { should.not.exist(err); PostWithDate.create([..], done});
@ssh24 Thank you for the hint! I have changed the code, but can't leave the I came up with this solution (tests are OK): function createTestFixtures(done) { PostWithDate = db.define('PostWithDate', { title: {type: String, length: 255, index: true}, content: {type: String}, created: { type: String, postgresql: { dataType: 'timestamp with time zone' } } }); db.automigrate(function(err, result) { if (err) throw err; Post.create([{ title: 't1', content: 'T1_TestCase', }, { title: 't2', content: 'T2_TheOtherCase', }], function(err, result) { should.not.exist(err); PostWithDate.create([ { title: 'Title 1', content: 'Content 1', created: '2017-05-17 12:00:01' }, { title: 'Title 2', content: 'Content 2', created: '2017-04-17 12:00:01' }, ], done); }); }); } If this code looks good for you I'll make a commit :). Other question:
Is this only for me? Should I change something in my config to pass these tests too? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ptrblgh That sounds good to me 👍. Also please make the changes I have requested on the deleteTestFixtures
function to destroy the data after the test.
Also not sure why some tests are failing on your local. I just did a dry run on my local with the changes and it all passed. The tests that failed are juggler tests. Could you install your dependencies again using npm i
? Maybe you are using an older version of juggler/connector.
test/postgresql.test.js Outdated
}); | ||
| ||
function deleteTestFixtures(done) { | ||
Post.destroyAll(done); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also destroy the data after the test is done here?
function deleteTestFixtures(done) { Post.destroyAll(function(err) { should.not.exist(err); PostWithDate.destroyAll(done); }); }
@ssh24 missing clean up added to the test case. |
2d9073c
to 0b9074c
Compare
Related to #247 .