Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrashed-dev committed Feb 22, 2024
1 parent 5e55c27 commit 261baf2
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/resources/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ describe('Auth', () => {
it('should call apiClient.request with the correct params', async () => {
await auth.detectProvider({
email: '[email protected]',
clientId: 'testClientId',
allProviderTypes: true,
});
});
Expand Down
36 changes: 36 additions & 0 deletions tests/resources/folders.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import APIClient from '../../src/apiClient';
import { Folders } from '../../src/resources/folders';
import { objKeysToCamelCase } from '../../src/utils';
jest.mock('../../src/apiClient');

describe('Folders', () => {
Expand All @@ -17,6 +18,41 @@ describe('Folders', () => {
apiClient.request.mockResolvedValue({});
});

describe('deserializing', () => {
it('should return a folder object as expected', () => {
const apiFolder = {
id: 'SENT',
grant_id: '41009df5-bf11-4c97-aa18-b285b5f2e386',
name: 'SENT',
system_folder: true,
object: 'folder',
unread_count: 0,
child_count: 0,
parent_id: 'ascsf21412',
background_color: '#039BE5',
text_color: '#039BE5',
total_count: 0,
attributes: ['\\SENT'],
};

const folder = objKeysToCamelCase(apiFolder);
expect(folder).toEqual({
id: 'SENT',
grantId: '41009df5-bf11-4c97-aa18-b285b5f2e386',
name: 'SENT',
systemFolder: true,
object: 'folder',
unreadCount: 0,
childCount: 0,
parentId: 'ascsf21412',
backgroundColor: '#039BE5',
textColor: '#039BE5',
totalCount: 0,
attributes: ['\\SENT'],
});
});
});

describe('list', () => {
it('should call apiClient.request with the correct params', async () => {
await folders.list({
Expand Down

0 comments on commit 261baf2

Please sign in to comment.