Created
July 30, 2014 00:46
-
-
Save jchris/54b02e30db19a758a956 to your computer and use it in GitHub Desktop.
tests for CBL Document class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tests for cbl.Document | |
"use strict"; | |
var cbl = require(".."), | |
util = require("./util"); | |
// Document | |
// A Couchbase Lite Document. | |
// | |
util.test("Document: Properties", function(t){ | |
t.test("database", function(t){ | |
// Gets the Database that owns this Document. | |
t.end(); | |
}); | |
t.test("id", function(t){ | |
// Gets the Document's id. | |
t.end(); | |
}); | |
t.test("isDeleted", function(t){ | |
// Gets if the Document is deleted. | |
t.end(); | |
}); | |
t.test("currentRevisionId", function(t){ | |
// If known, gets the Id of the current Revision, otherwise null. | |
t.end(); | |
}); | |
t.test("currentRevision", function(t){ | |
// Gets the current/latest Revision. | |
t.end(); | |
}); | |
t.test("revisionHistory", function(t){ | |
// Gets the Document's Revision history in forward order. Older, ancestor, Revisions are not guaranteed to have their properties available. | |
t.end(); | |
}); | |
t.test("conflictingRevisions", function(t){ | |
// Gets all of the current conflicting Revisions for the Document. If the Document is not in conflict, only the single current Revision will be returned. | |
t.end(); | |
}); | |
t.test("leafRevisions", function(t){ | |
// Gets all of the leaf Revisions in the Document's Revision tree. | |
t.end(); | |
}); | |
t.test("properties", function(t){ | |
// Gets the properties of the current Revision of the Document. | |
t.end(); | |
}); | |
t.test("userProperties", function(t){ | |
// Gets the properties of the current Revision of the Document without any properties with keys prefixed with '_' (which contain Couchbase Lite data). | |
t.end(); | |
}); | |
t.test("model", function(t){ | |
// Gets or sets a reference to an optional application-defined model object representing this Document. | |
t.end(); | |
}); | |
}); | |
util.test("Document: Methods", function(t){ | |
t.test("function delete();", function(t){ | |
// Deletes the Document. | |
t.end(); | |
}); | |
t.test("function purge();", function(t){ | |
// Completely purges the Document from the local Database. This is different from delete in that it completely deletes everything related to the Document and does not replicate the deletes to other Databases. | |
t.end(); | |
}); | |
t.test("function getRevision(id);", function(t){ | |
// Returns the Revision with the specified id if it exists, otherwise null. | |
t.end(); | |
}); | |
t.test("function createRevision();", function(t){ | |
// Creates a new UnsavedRevision whose properties and attachments are initially identical to the current Revision. | |
t.end(); | |
}); | |
t.test("function getProperty(key);", function(t){ | |
// Returns the value of the property with the specified key. | |
t.end(); | |
}); | |
t.test("function putProperties(properties);", function(t){ | |
// Creates and saves a new Revision with the specified properties. To succeed the specified properties must include a '_rev' property whose value maches the current Revision's id. | |
t.end(); | |
}); | |
t.test("function update(delegate);", function(t){ | |
// Creates and saves a new Revision by allowing the caller to update the existing properties. Conflicts are handled by calling the delegate again. | |
t.end(); | |
}); | |
t.test("function addEventListener(eventName, listener);", function(t){ | |
// Adds a Document change delegate that will be called whenever the Document changes. | |
t.end(); | |
}); | |
t.test("function removeEventListener(eventName, listener);", function(t){ | |
// Removes the specified delegate as a listener for the Document change event. | |
t.end(); | |
}); | |
}); | |
// end Instance | |
// Delegates | |
// void ChangeDelegate(%ChangeEvent% event) | |
util.test("Document Delegate: function(event)", function(t){}); | |
// boolean UpdateDelegate(%UnsavedRevision% revision) | |
util.test("Document Delegate: function(revision)", function(t){}); | |
// end Delegates | |
// EventArgs Subclasses | |
// Document Event: event ChangeEvent | |
// The type of event raised when a Document changes. This event is not raised in response to local Document changes. | |
util.test("event ChangeEvent: Properties", function(t){ | |
t.test("source", function(t){ | |
// Gets the Document that raised the event. | |
t.end(); | |
}); | |
t.test("change", function(t){ | |
// Gets the details of the change. | |
t.end(); | |
}); | |
}); | |
//end EventArgs Subclasses | |
// DocumentChange | |
// Provides details about a Document change. | |
// | |
util.test("DocumentChange: Properties", function(t){ | |
t.test("documentId", function(t){ | |
// Gets the Id of the Document that changed. | |
t.end(); | |
}); | |
t.test("revisionId", function(t){ | |
// Gets the Id of the new Revision. | |
t.end(); | |
}); | |
t.test("isCurrentRevision", function(t){ | |
// Gets if the Revision is the current Revision (i.e. it was chosen as the winner during default conflict resolution). | |
t.end(); | |
}); | |
t.test("isConflict", function(t){ | |
// Gets if the Document is in conflict. | |
t.end(); | |
}); | |
t.test("sourceUrl", function(t){ | |
// Gets the remote URL of the source Database from which this change was replicated. | |
t.end(); | |
}); | |
}); | |
// end Instance | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment