Skip to content

Commit

Permalink
fix: message of backup command (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Aug 27, 2019
1 parent cb34bbd commit b5f1676
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ typedoc/
# Built API documentation
site/

# Rope library folder
.vscode/.ropeproject/

# Virtual Python environment
.venv

# Visual Studio Code configuration
.vscode/
2 changes: 1 addition & 1 deletion lib/notifications/CommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class CommandHandler {
try {
await this.backupScheduler.uploadDatabase(new Date());

await this.discord.sendMessage('Uploaded backup of databases');
await this.discord.sendMessage('Uploaded backup of Boltz database');
} catch (error) {
await this.discord.sendMessage(`Could not upload backup: ${error}`);
}
Expand Down
8 changes: 6 additions & 2 deletions test/unit/notifications/CommandHandler.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ jest.mock('../../../lib/service/Service', () => {

const mockedService = <jest.Mock<Service>><any>Service;

const mockUploadDatabase = jest.fn().mockImplementation(() => Promise.resolve());

jest.mock('../../../lib/backup/BackupScheduler', () => {
return jest.fn().mockImplementation(() => {
return {
uploadDatabase: () => Promise.resolve(),
uploadDatabase: mockUploadDatabase,
};
});
});
Expand Down Expand Up @@ -295,8 +297,10 @@ describe('CommandHandler', () => {
sendMessage('backup');
await wait(5);

expect(mockUploadDatabase).toHaveBeenCalledTimes(1);

expect(mockSendMessage).toHaveBeenCalledTimes(1);
expect(mockSendMessage).toHaveBeenCalledWith('Uploaded backup of databases');
expect(mockSendMessage).toHaveBeenCalledWith('Uploaded backup of Boltz database');
});

afterAll(async () => {
Expand Down

0 comments on commit b5f1676

Please sign in to comment.