mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
fix: replace date formatting with getDbDateStr for consistency in plugin tests
This commit is contained in:
parent
778ef2e31d
commit
9294a8b4f3
1 changed files with 7 additions and 6 deletions
|
|
@ -596,6 +596,7 @@ import { TaskArchiveService } from '../features/archive/task-archive.service';
|
|||
import { Router } from '@angular/router';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { SyncWrapperService } from '../imex/sync/sync-wrapper.service';
|
||||
import { getDbDateStr } from '../util/get-db-date-str';
|
||||
|
||||
describe('PluginBridgeService - Counter Methods', () => {
|
||||
let service: PluginBridgeService;
|
||||
|
|
@ -651,7 +652,7 @@ describe('PluginBridgeService - Counter Methods', () => {
|
|||
// Arrange
|
||||
const counterId = 'new-counter';
|
||||
const value = 10;
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const today = getDbDateStr();
|
||||
|
||||
// Act
|
||||
await service.setCounter(counterId, value);
|
||||
|
|
@ -676,7 +677,7 @@ describe('PluginBridgeService - Counter Methods', () => {
|
|||
// Arrange
|
||||
const counterId = 'existing-counter';
|
||||
const value = 15;
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const today = getDbDateStr();
|
||||
|
||||
// Act
|
||||
await service.setCounter(counterId, value);
|
||||
|
|
@ -707,8 +708,8 @@ describe('PluginBridgeService - Counter Methods', () => {
|
|||
|
||||
describe('incrementCounter', () => {
|
||||
it('should increment existing counter value', async () => {
|
||||
// Arrange: existing counter has value 5 for 2025-12-30
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
// Arrange: existing counter has value 5 for today
|
||||
const today = getDbDateStr();
|
||||
store.overrideSelector(selectAllSimpleCounters, [
|
||||
{ ...mockExistingCounter, countOnDay: { [today]: 5 } },
|
||||
]);
|
||||
|
|
@ -741,7 +742,7 @@ describe('PluginBridgeService - Counter Methods', () => {
|
|||
describe('decrementCounter', () => {
|
||||
it('should decrement existing counter value', async () => {
|
||||
// Arrange
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const today = getDbDateStr();
|
||||
store.overrideSelector(selectAllSimpleCounters, [
|
||||
{ ...mockExistingCounter, countOnDay: { [today]: 10 } },
|
||||
]);
|
||||
|
|
@ -755,7 +756,7 @@ describe('PluginBridgeService - Counter Methods', () => {
|
|||
|
||||
it('should not go below zero', async () => {
|
||||
// Arrange
|
||||
const today = new Date().toISOString().split('T')[0];
|
||||
const today = getDbDateStr();
|
||||
store.overrideSelector(selectAllSimpleCounters, [
|
||||
{ ...mockExistingCounter, countOnDay: { [today]: 2 } },
|
||||
]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue