not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1018 B

  1. define(["sugar-web/env", "sugar-web/datastore"], function (env, datastore) {
  2. 'use strict';
  3. describe("Ensure the datastore object has an objectId", function () {
  4. // FIXME does not work in standalone mode
  5. it("should have objectId", function () {
  6. var objectId = "objectId";
  7. spyOn(env, "getObjectId").andCallFake(function (callback) {
  8. setTimeout(function () {
  9. callback(objectId);
  10. }, 0);
  11. });
  12. var callback = jasmine.createSpy();
  13. var datastoreObject = new datastore.DatastoreObject();
  14. runs(function () {
  15. datastoreObject.ensureObjectId(callback);
  16. });
  17. waitsFor(function () {
  18. return datastoreObject.objectId !== undefined;
  19. }, "should have objectId received from the environment");
  20. runs(function () {
  21. expect(callback).toHaveBeenCalled();
  22. });
  23. });
  24. });
  25. });