Skip to content

Commit

Permalink
Test that conversion on hours per day works on all formats
Browse files Browse the repository at this point in the history
  • Loading branch information
tupaschoal committed Dec 26, 2024
1 parent e670297 commit 72555bc
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions __tests__/__renderer__/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ window.mainApi = preferencesApi;
window.mainApi.getUserPreferencesPromise = () => { return new Promise((resolve) => resolve(getUserPreferences())); };

const {
convertTimeFormat,
refreshContent,
populateLanguages,
listenerLanguage,
Expand Down Expand Up @@ -215,5 +216,48 @@ describe('Test Preferences Window', () =>
assert.notStrictEqual(lastValue, '');
});
});

describe('Check if configure hours per day conversion function', () =>
{
test('should convert single digit hour to HH:MM format', () =>
{
assert.strictEqual(convertTimeFormat('6'), '06:00');
});

test('should convert double digit hour to HH:MM format', () =>
{
assert.strictEqual(convertTimeFormat('12'), '12:00');
});

test('should convert H.M format to HH:MM format', () =>
{
assert.strictEqual(convertTimeFormat('6.5'), '06:30');
});

test('should convert H.MM format to HH:MM format', () =>
{
assert.strictEqual(convertTimeFormat('6.50'), '06:30');
});

test('should convert HH.M format to HH:MM format', () =>
{
assert.strictEqual(convertTimeFormat('12.5'), '12:30');
});

test('should convert HH.MM format to HH:MM format', () =>
{
assert.strictEqual(convertTimeFormat('12.50'), '12:30');
});

test('should convert H:MM format to HH:MM format', () =>
{
assert.strictEqual(convertTimeFormat('6:30'), '06:30');
});

test('should convert HH:MM format to HH:MM format', () =>
{
assert.strictEqual(convertTimeFormat('12:30'), '12:30');
});
});
});

1 change: 1 addition & 0 deletions src/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ $(() =>
});

export {
convertTimeFormat,
refreshContent,
populateLanguages,
listenerLanguage,
Expand Down

0 comments on commit 72555bc

Please sign in to comment.