Skip to content

Commit

Permalink
added test and corrected status code
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Huber committed Jul 4, 2019
1 parent bf635e3 commit 0619e11
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/actions/table/DeleteTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 12,7 @@ class DeleteTable {
process(request, res) {
tableStorageManager.deleteTable(request).then((response) => {
res.set(request.httpProps);
res.status(201).send();
res.status(204).send();
});
}
}
Expand Down
19 changes: 17 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions test/01_Basic_table_Tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 451,38 @@ describe("Table HTTP Api tests", () => {
});
});


describe("DELETE and Delete Table operations", (done) => {
it("should not fail to delete a Table", (done) => {
const deleteTableService = azureStorage.createTableService(
"UseDevelopmentStorage=true"
);

const tempEntity = {
PartitionKey: entGen.String(partitionKeyForTest),
RowKey: entGen.String("4"),
description: entGen.String("qux"),
dueDate: entGen.DateTime(new Date(Date.UTC(2018, 12, 26))),
};

// Request is made by default with "return-no-content" when using the storage-sdk
// https://docs.microsoft.com/en-us/rest/api/storageservices/delete-table
// status code should be 204
deleteTableService.deleteTable(tableName,
{
echoContent: false,
},
function (error, result, response) {
if (error !== null) {
throw error;
}
expect(result.statusCode).to.equal(204);
done();
}
);
});
});

after(() => azurite.close());

});

0 comments on commit 0619e11

Please sign in to comment.