summaryrefslogtreecommitdiffstats
path: root/apps/files_versions/tests/js/versioncollectionSpec.js
blob: 305685b71df8d9a72c6702aaf927bb4312f764ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * 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',
			name: 'some file.txt',
			id: 10,
		});
		collection = new VersionCollection();
		collection.setFileInfo(fileInfoModel);
		collection.setCurrentUser('user');
	});
	it('fetches the versions', function() {
		collection.fetch();

		expect(fakeServer.requests.length).toEqual(1);
		expect(fakeServer.requests[0].url).toEqual(
			OC.linkToRemoteBase('dav') + '/versions/user/versions/10'
		);
		fakeServer.requests[0].respond(200);
	});
});