versioncollectionSpec.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Copyright (c) 2015
  3. *
  4. * @author Robin Appelman <robin@icewind.nl>
  5. * @author Vincent Petry <vincent@nextcloud.com>
  6. *
  7. * @license AGPL-3.0-or-later
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. describe('OCA.Versions.VersionCollection', function() {
  24. var VersionCollection = OCA.Versions.VersionCollection;
  25. var collection, fileInfoModel;
  26. beforeEach(function() {
  27. fileInfoModel = new OCA.Files.FileInfoModel({
  28. path: '/subdir',
  29. name: 'some file.txt',
  30. id: 10,
  31. });
  32. collection = new VersionCollection();
  33. collection.setFileInfo(fileInfoModel);
  34. collection.setCurrentUser('user');
  35. });
  36. it('fetches the versions', function() {
  37. collection.fetch();
  38. expect(fakeServer.requests.length).toEqual(1);
  39. expect(fakeServer.requests[0].url).toEqual(
  40. OC.linkToRemoteBase('dav') + '/versions/user/versions/10'
  41. );
  42. fakeServer.requests[0].respond(200);
  43. });
  44. });