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

Test object with prototype #133

Merged
merged 2 commits into from Feb 3, 2020
Merged

Test object with prototype #133

merged 2 commits into from Feb 3, 2020

Conversation

ryanbecker
Copy link

This unit test currently fails, but will pass when the cached object is either not cloned or cloned with lodash.cloneDeep.

@BryanDonovan
Copy link
Collaborator

Thanks! I'll look into this asap.

@BryanDonovan
Copy link
Collaborator

The problem is that a different test ends up failing (the one that checks that a basic function is left in tact). Hopefully there's a way to make all situations work.

@BryanDonovan
Copy link
Collaborator

BryanDonovan commented Feb 3, 2020

Oops, when I tested this I didn't put the call to cloneDeep after the check for type Object. Works now.

@@ -79,6 +79,23 @@ describe("memory store", function() {
}, opts, cb);
}

function getCachedObjectyWithPrototype(name, cb) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: There's a stray y after Object in the function name.

@coveralls
Copy link

coveralls commented Feb 3, 2020

Coverage Status

Coverage remained the same at 99.46% when pulling 4cad6bb on ryanbecker:master into 4c07564 on BryanDonovan:master.

@BryanDonovan
Copy link
Collaborator

BryanDonovan commented Feb 3, 2020

Edit: never mind the below.

Hmm.. this fails though:

            function getCachedNestedFunction(name, cb) {
                cache.wrap(key, function(cacheCb) {
                    cacheCb(null, {
                        fizzle: function() {
                            return 'foo';
                        }
                    });
                }, opts, cb);
            }
//[...]
           it("preserves nested functions", function(done) {
                getCachedNestedFunction('foo', function(err, result) {
                    checkErr(err);
                    assert.equal(typeof result, 'function');

                    getCachedNestedFunction('foo', function(err, result) {
                        checkErr(err);
                        assert.equal(typeof result.fizzle, 'function');
                        done();
                    });
                });
            });

@BryanDonovan BryanDonovan changed the base branch from master to develop February 3, 2020 19:54
@BryanDonovan BryanDonovan merged commit 1c668eb into jaredwray:develop Feb 3, 2020
@BryanDonovan
Copy link
Collaborator

Thanks for the fix @ryanbecker!

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.

None yet

3 participants