Commit aa6ed5aa authored by Bryan Kaperick's avatar Bryan Kaperick

Added one additional attachment test.

parent cf5671c3
......@@ -281,6 +281,59 @@
.always(function () {start(); });
});
test("Correctness of allAttachments method",
function () {
stop();
expect(4);
var jio = this.jio,
timestamps = jio.__storage._timestamps,
blob1 = this.blob1,
blob2 = this.blob2,
other_blob1 = this.other_blob,
other_blob2 = new Blob(['asdf']);
putFullDoc(jio, "doc", {}, "data", blob1)
.push(function () {
return jio.putAttachment("doc", "data", blob2);
})
.push(function () {
return jio.putAttachment("doc", "other_data", other_blob1);
})
.push(function () {
return jio.putAttachment("doc", "other_data", other_blob2);
})
.push(function () {
return jio.getAttachment(timestamps.doc.data[0], "data");
})
.push(function (result) {
deepEqual(result, blob1, "Get old version of first attachment");
return jio.getAttachment(timestamps.doc.data[1], "data");
})
.push(function (result) {
deepEqual(result, blob2, "Get current version of first attachment");
return jio.getAttachment(timestamps.doc.other_data[0], "other_data");
})
.push(function (result) {
deepEqual(
result,
other_blob1,
"Get old version of second attachment"
);
return jio.getAttachment(timestamps.doc.other_data[1], "other_data");
})
.push(function (result) {
deepEqual(
result,
other_blob2,
"Get current version of second attachment"
);
})
.fail(function (error) {
//console.log(error);
ok(false, error);
})
.always(function () {start(); });
});
/////////////////////////////////////////////////////////////////
// Querying older revisions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment