Skip to content

Commit

Permalink
fix: session duration can't be updated
Browse files Browse the repository at this point in the history
  • Loading branch information
stonith404 committed Aug 19, 2024
1 parent a5dfdd2 commit 4780548
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion backend/internal/model/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ type AppConfig struct {
}

type AppConfigUpdateDto struct {
AppName string `json:"appName" binding:"required"`
AppName string `json:"appName" binding:"required"`
SessionDuration string `json:"sessionDuration" binding:"required"`
}
4 changes: 2 additions & 2 deletions backend/internal/service/app_config_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var defaultDbConfig = model.AppConfig{
}

func (s *AppConfigService) UpdateApplicationConfiguration(input model.AppConfigUpdateDto) ([]model.AppConfigVariable, error) {
savedConfigVariables := make([]model.AppConfigVariable, 10)
var savedConfigVariables []model.AppConfigVariable

tx := s.db.Begin()
rt := reflect.ValueOf(input).Type()
Expand All @@ -78,7 +78,7 @@ func (s *AppConfigService) UpdateApplicationConfiguration(input model.AppConfigU
return nil, err
}

savedConfigVariables[i] = applicationConfigurationVariable
savedConfigVariables = append(savedConfigVariables, applicationConfigurationVariable)
}

tx.Commit()
Expand Down
6 changes: 5 additions & 1 deletion frontend/tests/application-configuration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ test('Update general configuration', async ({ page }) => {
await page.getByLabel('Session Duration').fill('30');
await page.getByRole('button', { name: 'Save' }).first().click();

await expect(page.getByTestId('application-name')).toHaveText('Updated Name');
await expect(page.getByRole('status')).toHaveText(
'Application configuration updated successfully'
);

await page.reload();

await expect(page.getByTestId('application-name')).toHaveText('Updated Name');
await expect(page.getByTestId('session-duration')).toHaveText('30');

Check failure on line 20 in frontend/tests/application-configuration.spec.ts

View workflow job for this annotation

GitHub Actions / build-and-test

[chromium] › application-configuration.spec.ts:6:1 › Update general configuration

1) [chromium] › application-configuration.spec.ts:6:1 › Update general configuration ───────────── Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: getByTestId('session-duration') Expected string: "30" Received: <element(s) not found> Call log: - expect.toHaveText with timeout 5000ms - waiting for getByTestId('session-duration') 18 | 19 | await expect(page.getByTestId('application-name')).toHaveText('Updated Name'); > 20 | await expect(page.getByTestId('session-duration')).toHaveText('30'); | ^ 21 | }); 22 | 23 | test('Update application images', async ({ page }) => { at /home/runner/work/pocket-id/pocket-id/frontend/tests/application-configuration.spec.ts:20:53

Check failure on line 20 in frontend/tests/application-configuration.spec.ts

View workflow job for this annotation

GitHub Actions / build-and-test

[chromium] › application-configuration.spec.ts:6:1 › Update general configuration

1) [chromium] › application-configuration.spec.ts:6:1 › Update general configuration ───────────── Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: Timed out 5000ms waiting for expect(locator).toHaveText(expected) Locator: getByTestId('session-duration') Expected string: "30" Received: <element(s) not found> Call log: - expect.toHaveText with timeout 5000ms - waiting for getByTestId('session-duration') 18 | 19 | await expect(page.getByTestId('application-name')).toHaveText('Updated Name'); > 20 | await expect(page.getByTestId('session-duration')).toHaveText('30'); | ^ 21 | }); 22 | 23 | test('Update application images', async ({ page }) => { at /home/runner/work/pocket-id/pocket-id/frontend/tests/application-configuration.spec.ts:20:53
});

test('Update application images', async ({ page }) => {
Expand Down

0 comments on commit 4780548

Please sign in to comment.