Skip to content

Commit

Permalink
Add test case for listBlobsFlat - for loop syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
HarshaNalluru committed May 30, 2019
1 parent 3fb743a commit 842de33
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion sdk/storage/storage-blob/test/containerclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ describe("ContainerClient", () => {
}
});

it("Verify AsyncIterator for listBlobsFlat", async () => {
it("Verify AsyncIterator(generator .next() syntax) for listBlobsFlat", async () => {
const blobClients = [];
const prefix = "blockblob";
const metadata = {
Expand Down Expand Up @@ -256,6 +256,38 @@ describe("ContainerClient", () => {
}
});

it("Verify AsyncIterator(for-loop syntax) for listBlobsFlat", async () => {
const blobClients = [];
const prefix = "blockblob";
const metadata = {
keya: "a",
keyb: "c"
};
for (let i = 0; i < 4; i++) {
const blobClient = containerClient.createBlobClient(getUniqueName(`${prefix}/${i}`));
const blockBlobClient = blobClient.createBlockBlobClient();
await blockBlobClient.upload("", 0, {
metadata
});
blobClients.push(blobClient);
}

let i = 0;
for await (const blob of containerClient.listBlobsFlat({
include: ["snapshots", "metadata", "uncommittedblobs", "copy", "deleted"],
prefix,
maxresults: 2
})) {
assert.ok(blobClients[i].url.indexOf(blob.name));
assert.deepStrictEqual(blob.metadata, metadata);
i++;
}

for (const blob of blobClients) {
await blob.delete();
}
});

it("listBlobHierarchySegment with default parameters", async () => {
const blobClients = [];
for (let i = 0; i < 3; i++) {
Expand Down

0 comments on commit 842de33

Please sign in to comment.