Skip to content

Commit

Permalink
Merge pull request #791 from dynamoosejs/generalImprovements
Browse files Browse the repository at this point in the history
General improvements
  • Loading branch information
fishcharlie committed Apr 8, 2020
2 parents 4f310d9 + 6f8bf70 commit 17cd52f
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/utils/object/entries.js
Expand Up @@ -4,7 +4,7 @@ const main = module.exports = (object, existingKey = "") => {
const keyWithExisting = `${existingKey ? `${existingKey}.` : ""}${key}`;
accumulator.push([keyWithExisting, value]);

if (typeof value === "object" && value !== null) {
if (typeof value === "object" && !(value instanceof Buffer) && value !== null) {
accumulator.push(...main(value, keyWithExisting));
}

Expand Down
1 change: 1 addition & 0 deletions test/Document.js
Expand Up @@ -1059,6 +1059,7 @@ describe("Document", () => {
describeTableResponse = {
"Table": {"TableStatus": "ACTIVE"}
};
await model.Model.pendingTaskPromise();
await utils.set_immediate_promise();
expect(putParams).to.eql([{
"Item": {
Expand Down
3 changes: 3 additions & 0 deletions test/Model.js
Expand Up @@ -148,6 +148,7 @@ describe("Model", () => {
describeTableResponse = {
"Table": {"TableStatus": "ACTIVE"}
};
await model.Model.pendingTaskPromise();
await utils.set_immediate_promise();
expect(pendingTaskPromiseResolved).to.be.true;
expect(model.Model.pendingTasks).to.eql([]);
Expand Down Expand Up @@ -1077,6 +1078,7 @@ describe("Model", () => {
describeTableResponse = {
"Table": {"TableStatus": "ACTIVE"}
};
await model.Model.pendingTaskPromise();
await utils.set_immediate_promise();
expect(calledGetItem).to.be.true;
expect({...user}).to.eql({"id": 1, "name": "Charlie"});
Expand Down Expand Up @@ -1291,6 +1293,7 @@ describe("Model", () => {
describeTableResponse = {
"Table": {"TableStatus": "ACTIVE"}
};
await model.Model.pendingTaskPromise();
await utils.set_immediate_promise();
expect(calledBatchGetItem).to.be.true;
expect(users.map((user) => ({...user}))).to.eql([{"id": 1, "name": "Charlie"}]);
Expand Down
4 changes: 4 additions & 0 deletions test/utils/object/entries.js
Expand Up @@ -34,6 +34,10 @@ describe("utils.object.entries", () => {
{
"input": {"id": 1, "friends": [{"name": "Bob", "id": 1}, {"name": "Tim"}]},
"output": [["id", 1], ["friends", [{"name": "Bob", "id": 1}, {"name": "Tim"}]], ["friends.0", {"name": "Bob", "id": 1}], ["friends.0.name", "Bob"], ["friends.0.id", 1], ["friends.1", {"name": "Tim"}], ["friends.1.name", "Tim"]]
},
{
"input": {"hello": Buffer.from("world")},
"output": [["hello", Buffer.from("world")]]
}
];

Expand Down
4 changes: 4 additions & 0 deletions test/utils/object/keys.js
Expand Up @@ -26,6 +26,10 @@ describe("utils.object.keys", () => {
{
"input": {"id": 1, "friends": [{"name": "Bob", "id": 1}, {"name": "Tim"}]},
"output": ["id", "friends", "friends.0", "friends.0.name", "friends.0.id", "friends.1", "friends.1.name"]
},
{
"input": {"hello": Buffer.from("world")},
"output": ["hello"]
}
];

Expand Down

0 comments on commit 17cd52f

Please sign in to comment.