2021-03-31 13:15:40 +03:00
|
|
|
/**
|
2015-09-01 20:29:55 +03:00
|
|
|
* Copyright (c) 2015
|
|
|
|
*
|
2021-03-31 13:15:40 +03:00
|
|
|
* @author Robin Appelman <robin@icewind.nl>
|
|
|
|
* @author Vincent Petry <vincent@nextcloud.com>
|
2015-09-01 20:29:55 +03:00
|
|
|
*
|
2021-03-31 13:15:40 +03:00
|
|
|
* @license GNU AGPL version 3 or any later version
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2015-09-01 20:29:55 +03:00
|
|
|
*
|
|
|
|
*/
|
2021-03-31 13:15:40 +03:00
|
|
|
|
2015-09-01 20:29:55 +03:00
|
|
|
describe('OCA.Versions.VersionCollection', function() {
|
|
|
|
var VersionCollection = OCA.Versions.VersionCollection;
|
|
|
|
var collection, fileInfoModel;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
fileInfoModel = new OCA.Files.FileInfoModel({
|
|
|
|
path: '/subdir',
|
2018-10-11 17:59:04 +03:00
|
|
|
name: 'some file.txt',
|
|
|
|
id: 10,
|
2015-09-01 20:29:55 +03:00
|
|
|
});
|
|
|
|
collection = new VersionCollection();
|
|
|
|
collection.setFileInfo(fileInfoModel);
|
2018-10-11 17:59:04 +03:00
|
|
|
collection.setCurrentUser('user');
|
2015-09-01 20:29:55 +03:00
|
|
|
});
|
2018-10-11 17:59:04 +03:00
|
|
|
it('fetches the versions', function() {
|
|
|
|
collection.fetch();
|
2015-09-01 20:29:55 +03:00
|
|
|
|
|
|
|
expect(fakeServer.requests.length).toEqual(1);
|
|
|
|
expect(fakeServer.requests[0].url).toEqual(
|
2018-10-11 17:59:04 +03:00
|
|
|
OC.linkToRemoteBase('dav') + '/versions/user/versions/10'
|
2015-09-01 20:29:55 +03:00
|
|
|
);
|
2018-10-11 17:59:04 +03:00
|
|
|
fakeServer.requests[0].respond(200);
|
2015-09-01 20:29:55 +03:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|