Skip to content

Commit

Permalink
Merge pull request #56 from Root-App/ivanbtrujillo-camera-roll-mock
Browse files Browse the repository at this point in the history
Updates pull request 49 to remove package-lock.json from .gitignore
  • Loading branch information
bob-carson authored Aug 14, 2018
2 parents 97381af + f243260 commit ddabb6b
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 5 deletions.
50 changes: 45 additions & 5 deletions src/NativeModules/CameraRollManager.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,53 @@

const CameraRollManager = {
saveImageWithTag(imageTag) {
return Promise.resolve(['/asset/url']);
},
getPhotos(params) {
return Promise.resolve([
// TODO(lmr):
]);
},
return Promise.resolve({
edges: [
{
node: {
type: 'image/jpeg',
group_name: 'Camera',
image: {
uri: 'content://media/external/images/media/1',
height: 2448,
width: 3968
},
timestamp: 1528972673375
}
},
{
node: {
type: 'image/jpeg',
group_name: 'Camera',
image: {
uri: 'content://media/external/images/media/2',
height: 2448,
width: 3968
},
timestamp: 1528972673375
}
},
{
node: {
type: 'image/jpeg',
group_name: 'Camera',
image: {
uri: 'content://media/external/images/media/3',
height: 2448,
width: 3968
},
timestamp: 1528972673375
}
}
],
page_info: {
has_next_page: true,
end_cursor: '1528919312601'
}
});
}
};

module.exports = CameraRollManager;
53 changes: 53 additions & 0 deletions test/api/CameraRoll.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { expect } from 'chai';
import CameraRoll from '../../src/api/CameraRoll';

describe('CameraRoll', () => {
it('getPhotos', () => {
const expectedResult = {
edges: [
{
node: {
type: 'image/jpeg',
group_name: 'Camera',
image: {
uri: 'content://media/external/images/media/1',
height: 2448,
width: 3968
},
timestamp: 1528972673375
}
},
{
node: {
type: 'image/jpeg',
group_name: 'Camera',
image: {
uri: 'content://media/external/images/media/2',
height: 2448,
width: 3968
},
timestamp: 1528972673375
}
},
{
node: {
type: 'image/jpeg',
group_name: 'Camera',
image: {
uri: 'content://media/external/images/media/3',
height: 2448,
width: 3968
},
timestamp: 1528972673375
}
}
],
page_info: {
has_next_page: true,
end_cursor: '1528919312601'
}
};

CameraRoll.getPhotos().then(photos => expect(photos).to.deep.equal(expectedResult));
});
});

0 comments on commit ddabb6b

Please sign in to comment.