Skip to content

Commit

Permalink
Fix javascript tests
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <[email protected]>
  • Loading branch information
rullzer committed Oct 19, 2016
1 parent 3b02a74 commit 92788cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 37 deletions.
19 changes: 0 additions & 19 deletions core/js/tests/specs/sharedialogshareelistview.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ describe('OC.Share.ShareDialogShareeListView', function () {
oldAppConfig = _.extend({}, oc_appconfig.core);
oc_appconfig.core.enforcePasswordForPublicLink = false;

$('#testArea').append('<input id="mailNotificationEnabled" name="mailNotificationEnabled" type="hidden" value="yes">');

fileInfoModel = new OCA.Files.FileInfoModel({
id: 123,
name: 'shared_file_name.txt',
Expand Down Expand Up @@ -139,23 +137,6 @@ describe('OC.Share.ShareDialogShareeListView', function () {
listView.$el.find('a.showCruds').click();
expect(listView.$el.find('li.cruds').hasClass('hidden')).toEqual(false);
});

it('sends notification to user when checkbox clicked', function () {
shareModel.set('shares', [{
id: 100,
item_source: 123,
permissions: 1,
share_type: OC.Share.SHARE_TYPE_USER,
share_with: 'user1',
share_with_displayname: 'User One'
}]);
listView.render();
var notificationStub = sinon.stub(listView.model, 'sendNotificationForShare');
listView.$el.find("input[name='mailNotification']").click();
expect(notificationStub.called).toEqual(true);
notificationStub.restore();
});

});

});
24 changes: 6 additions & 18 deletions core/js/tests/specs/shareitemmodelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,18 +494,12 @@ describe('OC.Share.ShareItemModel', function() {

expect(res.state()).toEqual('pending');
expect(fakeServer.requests.length).toEqual(1);
expect(fakeServer.requests[0].url).toEqual(OC.generateUrl('core/ajax/share.php'));
expect(fakeServer.requests[0].url).toEqual(OC.linkToOCS('apps/files_sharing/api/v1', 2) + 'shares/20/emailLink?format=json');
expect(OC.parseQueryString(fakeServer.requests[0].requestBody)).toEqual(
{
action: 'email',
toaddress: '[email protected]',
link: model.get('linkShare').link,
itemType: 'file',
itemSource: '123',
file: 'shared_file_name.txt',
expiration: ''
}
)
);

fakeServer.requests[0].respond(
200,
Expand Down Expand Up @@ -544,21 +538,15 @@ describe('OC.Share.ShareItemModel', function() {

expect(res.state()).toEqual('pending');
expect(fakeServer.requests.length).toEqual(1);
expect(fakeServer.requests[0].url).toEqual(OC.generateUrl('core/ajax/share.php'));
expect(fakeServer.requests[0].url).toEqual(OC.linkToOCS('apps/files_sharing/api/v1', 2) + 'shares/20/emailLink?format=json');
expect(OC.parseQueryString(fakeServer.requests[0].requestBody)).toEqual(
{
action: 'email',
toaddress: '[email protected]',
link: model.get('linkShare').link,
itemType: 'file',
itemSource: '123',
file: 'shared_file_name.txt',
expiration: ''
toaddress: '[email protected]'
}
)
);

fakeServer.requests[0].respond(
200,
403,
{ 'Content-Type': 'application/json' },
JSON.stringify({data: {message: 'fail'}, status: 'error'})
);
Expand Down

0 comments on commit 92788cc

Please sign in to comment.