-
-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed some warning during row creation, added title tags to navigat…
…ion items for mouseover descriptions, removed Type warnings and errors from render components, switched peggy to Typescript, got eslint to work.
- Loading branch information
Showing
97 changed files
with
8,614 additions
and
7,393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
dist | ||
out | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:react/recommended', | ||
'plugin:react/jsx-runtime', | ||
'@electron-toolkit/eslint-config-ts/recommended', | ||
'@electron-toolkit/eslint-config-prettier' | ||
], | ||
rules: { | ||
// Disable prop-types globally since you're using TypeScript | ||
'react/prop-types': 'off', | ||
// If you want to enforce explicit return types on functions in TypeScript | ||
'@typescript-eslint/explicit-function-return-type': 'warn' // Or 'error' if you prefer stricter rules | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
import { getActiveFile } from '../../main/modules/File/Active'; | ||
import { getActiveFile } from '../../main/modules/File/Active' | ||
|
||
jest.mock('../../main/config', () => ({ | ||
config: { | ||
get: jest.fn((key) => { | ||
if(key === 'files') { | ||
if (key === 'files') { | ||
return [ | ||
{ | ||
active: false, | ||
todoFileName: 'test1.txt', | ||
todoFilePath: '/test1.txt', | ||
todoFileBookmark: null, | ||
doneFilePath: 'done.txt', | ||
doneFileBookmark: null, | ||
doneFileBookmark: null | ||
}, | ||
{ | ||
active: true, | ||
todoFileName: 'test2.txt', | ||
todoFilePath: '/test2.txt', | ||
todoFileBookmark: null, | ||
doneFilePath: 'done.txt', | ||
doneFileBookmark: null, | ||
doneFileBookmark: null | ||
} | ||
]; | ||
] | ||
} | ||
}), | ||
set: jest.fn(), | ||
}, | ||
})); | ||
set: jest.fn() | ||
} | ||
})) | ||
|
||
describe('Get active file', () => { | ||
test('Should return the active file', () => { | ||
const activeFile = getActiveFile(); | ||
const activeFile = getActiveFile() | ||
expect(activeFile).toEqual({ | ||
active: true, | ||
todoFileName: 'test2.txt', | ||
todoFilePath: '/test2.txt', | ||
todoFileBookmark: null, | ||
doneFilePath: 'done.txt', | ||
doneFileBookmark: null, | ||
}); | ||
}); | ||
}); | ||
doneFileBookmark: null | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,82 @@ | ||
import { archiveTodos } from '../../main/modules/File/Archive'; | ||
import fs from 'fs'; | ||
import { archiveTodos } from '../../main/modules/File/Archive' | ||
import fs from 'fs' | ||
|
||
jest.mock('electron', () => ({ | ||
app: { | ||
setBadgeCount: jest.fn(), | ||
}, | ||
})); | ||
setBadgeCount: jest.fn() | ||
} | ||
})) | ||
|
||
jest.mock('../../main/main', () => ({ | ||
mainWindow: { | ||
webContents: { | ||
send: jest.fn(), | ||
}, | ||
}, | ||
})); | ||
send: jest.fn() | ||
} | ||
} | ||
})) | ||
|
||
jest.mock('../../main/config', () => ({ | ||
config: { | ||
get: jest.fn(() => { | ||
return [ | ||
{ active: false, todoFilePath: './src/__tests__/__mock__/test1.txt', todoFileName: 'test1.txt', todoFileBookmark: null, doneFilePath: './src/__tests__/__mock__/done.txt', doneFileBookmark: null }, | ||
{ active: true, todoFilePath: './src/__tests__/__mock__/archiving.txt', todoFileName: 'archiving.txt', todoFileBookmark: null, doneFilePath: './src/__tests__/__mock__/done.txt', doneFileBookmark: null }, | ||
{ active: false, todoFilePath: './src/__tests__/__mock__/test3.txt', todoFileName: 'test3.txt', todoFileBookmark: null, doneFilePath: './src/__tests__/__mock__/done.txt', doneFileBookmark: null }, | ||
]; | ||
{ | ||
active: false, | ||
todoFilePath: './src/__tests__/__mock__/test1.txt', | ||
todoFileName: 'test1.txt', | ||
todoFileBookmark: null, | ||
doneFilePath: './src/__tests__/__mock__/done.txt', | ||
doneFileBookmark: null | ||
}, | ||
{ | ||
active: true, | ||
todoFilePath: './src/__tests__/__mock__/archiving.txt', | ||
todoFileName: 'archiving.txt', | ||
todoFileBookmark: null, | ||
doneFilePath: './src/__tests__/__mock__/done.txt', | ||
doneFileBookmark: null | ||
}, | ||
{ | ||
active: false, | ||
todoFilePath: './src/__tests__/__mock__/test3.txt', | ||
todoFileName: 'test3.txt', | ||
todoFileBookmark: null, | ||
doneFilePath: './src/__tests__/__mock__/done.txt', | ||
doneFileBookmark: null | ||
} | ||
] | ||
}), | ||
set: jest.fn(), | ||
}, | ||
})); | ||
set: jest.fn() | ||
} | ||
})) | ||
|
||
jest.mock('../../main/modules/Menu', () => ({ | ||
createMenu: jest.fn(), | ||
})); | ||
createMenu: jest.fn() | ||
})) | ||
|
||
describe('Archiving', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
fs.writeFileSync('./src/__tests__/__mock__/archiving.txt', `Unfinished todo 1\nx 2022-02-01 Finished todo 3\nUnfinished todo 2\nx 2022-02-08 Finished todo 1\nUnfinished todo 3\nx 2022-02-17 Finished todo 2`, 'utf8'); | ||
fs.writeFileSync('./src/__tests__/__mock__/done.txt', `x 2022-02-02 todo from done.txt 1\nx 2022-02-03 todo from done.txt 2\nx 2022-02-04 todo from done.txt 3\nx 2022-02-05 todo from done.txt 4`, 'utf8'); | ||
}); | ||
beforeEach(() => { | ||
jest.clearAllMocks() | ||
fs.writeFileSync( | ||
'./src/__tests__/__mock__/archiving.txt', | ||
`Unfinished todo 1\nx 2022-02-01 Finished todo 3\nUnfinished todo 2\nx 2022-02-08 Finished todo 1\nUnfinished todo 3\nx 2022-02-17 Finished todo 2`, | ||
'utf8' | ||
) | ||
fs.writeFileSync( | ||
'./src/__tests__/__mock__/done.txt', | ||
`x 2022-02-02 todo from done.txt 1\nx 2022-02-03 todo from done.txt 2\nx 2022-02-04 todo from done.txt 3\nx 2022-02-05 todo from done.txt 4`, | ||
'utf8' | ||
) | ||
}) | ||
|
||
afterAll(() => { | ||
fs.unlinkSync('./src/__tests__/__mock__/archiving.txt'); | ||
fs.unlinkSync('./src/__tests__/__mock__/done.txt'); | ||
}); | ||
afterAll(() => { | ||
fs.unlinkSync('./src/__tests__/__mock__/archiving.txt') | ||
fs.unlinkSync('./src/__tests__/__mock__/done.txt') | ||
}) | ||
|
||
test('Should collect data from todo and done file and merge it properly', () => { | ||
archiveTodos(); | ||
const fileContent = fs.readFileSync('./src/__tests__/__mock__/done.txt', 'utf8'); | ||
const expectedContent = `x 2022-02-02 todo from done.txt 1\nx 2022-02-03 todo from done.txt 2\nx 2022-02-04 todo from done.txt 3\nx 2022-02-05 todo from done.txt 4\nx 2022-02-01 Finished todo 3\nx 2022-02-08 Finished todo 1\nx 2022-02-17 Finished todo 2`; | ||
setTimeout(() => expect(fileContent).toEqual(expectedContent), 1000); | ||
}); | ||
}); | ||
test('Should collect data from todo and done file and merge it properly', () => { | ||
archiveTodos() | ||
const fileContent = fs.readFileSync('./src/__tests__/__mock__/done.txt', 'utf8') | ||
const expectedContent = `x 2022-02-02 todo from done.txt 1\nx 2022-02-03 todo from done.txt 2\nx 2022-02-04 todo from done.txt 3\nx 2022-02-05 todo from done.txt 4\nx 2022-02-01 Finished todo 3\nx 2022-02-08 Finished todo 1\nx 2022-02-17 Finished todo 2` | ||
setTimeout(() => expect(fileContent).toEqual(expectedContent), 1000) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.