2019-03-03 06:39:57 +00:00
|
|
|
/**
|
|
|
|
* 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';
|
|
|
|
|
2019-03-03 10:54:13 +00:00
|
|
|
const NativeModule = require('../nativeInterface');
|
|
|
|
|
|
|
|
jest.mock('../nativeInterface');
|
2019-03-03 06:39:57 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
2019-08-14 19:00:20 +00:00
|
|
|
it('Should call save', async () => {
|
2019-08-14 19:31:43 +00:00
|
|
|
await CameraRoll.save('a tag', {type: 'photo'});
|
2019-08-14 19:00:20 +00:00
|
|
|
expect(NativeModule.saveToCameraRoll.mock.calls).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
|
2019-03-03 06:39:57 +00:00
|
|
|
it('Should call getPhotos', async () => {
|
|
|
|
await CameraRoll.getPhotos({first: 0});
|
|
|
|
expect(NativeModule.getPhotos.mock.calls).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|