SimonErm dc00a4f115 feat(lib): save photos or videos to an album
* add option to specify album in saveToCameraRoll and move the optional type param to options

* check platform before setting default value for group types to prevent exception

* adjust typings

* update invariant message

* format code

* extract new implementation to function to avoid breaking change

* format code

* add missing spaces

* fix(lib): add accidentally removed savedphotos back to the enum to prevent crash

* chore(lib): formatting

* chore(lib): add doc for the new save method
2019-08-14 21:00:20 +02:00

39 lines
1.0 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
import CameraRoll from '../CameraRoll';
const NativeModule = require('../nativeInterface');
jest.mock('../nativeInterface');
describe('CameraRoll', () => {
it('Should call deletePhotos', () => {
CameraRoll.deletePhotos(['a uri']);
expect(NativeModule.deletePhotos.mock.calls).toMatchSnapshot();
});
it('Should call saveToCameraRoll', async () => {
await CameraRoll.saveToCameraRoll('a tag', 'photo');
expect(NativeModule.saveToCameraRoll.mock.calls).toMatchSnapshot();
});
it('Should call save', async () => {
await CameraRoll.save('a tag', {type:'photo'});
expect(NativeModule.saveToCameraRoll.mock.calls).toMatchSnapshot();
});
it('Should call getPhotos', async () => {
await CameraRoll.getPhotos({first: 0});
expect(NativeModule.getPhotos.mock.calls).toMatchSnapshot();
});
});