Skip to content

Commit

Permalink
Merge pull request #18 from CSE-210-Team-6/justin-tests
Browse files Browse the repository at this point in the history
add more tests
  • Loading branch information
justinnguyen0 authored Nov 18, 2023
2 parents 66fa56d + 2847b55 commit cca7681
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/__tests__/account.jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { isMyPost } = require('../account');
import 'node-fetch';

jest.mock('node-fetch', () => jest.fn());
import { readJSONDictionary } from '../storage';

describe('Tests for isMyPost', () => {
test('Check if a post is my post', () => {
Expand All @@ -22,3 +23,14 @@ describe('Tests for isMyPost', () => {
expect(isMyPost(activity)).toBe(false);
});
});

describe('Tests for getInboxIndex', () => {
const getInboxIndex = () => {
const inboxIndexPath = 'lib/__tests__/files/inboxes.json';
const inboxIndex = readJSONDictionary(inboxIndexPath, {});
return inboxIndex;
};
test('Check successful', () => {
expect(getInboxIndex()).toStrictEqual({ id: 'test' });
});
});
3 changes: 3 additions & 0 deletions lib/__tests__/files/inboxes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"id": "test"
}

0 comments on commit cca7681

Please sign in to comment.