Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rajat-Dabade committed Feb 21, 2025
1 parent f048552 commit 20d7c19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 4 additions & 4 deletions app/actions/remote/scheduled_post.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ describe('fetchScheduledPosts', () => {

describe('updateScheduledPost', () => {
it('update Schedule post - handle not found database', async () => {
const result = await updateScheduledPost('foo', scheduledPost);
expect(result.error).toBe('foo database not found');
expect(logError).not.toHaveBeenCalled();
expect(forceLogoutIfNecessary).not.toHaveBeenCalled();
const result = await updateScheduledPost('foo', scheduledPost) as unknown as {error: Error};
expect(result).toEqual({error: 'foo database not found'});
expect(logError).toHaveBeenCalled();
expect(forceLogoutIfNecessary).toHaveBeenCalled();
});

it('update Schedule post - base case', async () => {
Expand Down
6 changes: 1 addition & 5 deletions app/actions/remote/scheduled_post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@ export async function createScheduledPost(serverUrl: string, schedulePost: Sched
}

export async function updateScheduledPost(serverUrl: string, scheduledPost: ScheduledPost, connectionId?: string, fetchOnly = false) {
const operator = DatabaseManager.serverDatabases[serverUrl]?.operator;
if (!operator) {
return {error: `${serverUrl} database not found`};
}

try {
const {operator} = DatabaseManager.getServerDatabaseAndOperator(serverUrl);
const client = NetworkManager.getClient(serverUrl);
const response = await client.updateScheduledPost(scheduledPost, connectionId);

Expand Down

0 comments on commit 20d7c19

Please sign in to comment.