2015-09-01 20:29:55 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2015
|
|
|
|
*
|
|
|
|
* This file is licensed under the Affero General Public License version 3
|
|
|
|
* or later.
|
|
|
|
*
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
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
|
|
|
});
|
|
|
|
});
|
|
|
|
|