Skip to content

[AudioController] Clean up methods and add tests#3841

Merged
imnasnainaec merged 6 commits intomasterfrom
audio-controller
Jun 5, 2025
Merged

[AudioController] Clean up methods and add tests#3841
imnasnainaec merged 6 commits intomasterfrom
audio-controller

Conversation

@imnasnainaec
Copy link
Collaborator

@imnasnainaec imnasnainaec commented Jun 4, 2025

  • DownloadAudioFile: removes unused wordId param
  • UploadAudioFile: verifies word exists before copying the file
  • Adds all missing ProducesResponseType attributes
  • Expands testing

This change is Reviewable

@imnasnainaec imnasnainaec self-assigned this Jun 4, 2025
@imnasnainaec imnasnainaec added backend test maintenance Issue that makes it difficult to maintain the software or to upgrade installations post-release. audio labels Jun 4, 2025
@codecov
Copy link

codecov bot commented Jun 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.34%. Comparing base (110c283) to head (c64f567).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3841      +/-   ##
==========================================
+ Coverage   73.24%   73.34%   +0.09%     
==========================================
  Files         286      286              
  Lines       10751    10750       -1     
  Branches     1341     1341              
==========================================
+ Hits         7875     7885      +10     
+ Misses       2479     2471       -8     
+ Partials      397      394       -3     
Flag Coverage Δ
backend 82.91% <100.00%> (+0.22%) ⬆️
frontend 65.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@myieye myieye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 👍

[Test]
public void TestUploadAudioFileNoWord()
{
var result = _audioController.UploadAudioFile(_projId, "not-a-user", _file).Result;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this was the intention.

Suggested change
var result = _audioController.UploadAudioFile(_projId, "not-a-user", _file).Result;
var result = _audioController.UploadAudioFile(_projId, "not-a-word", _file).Result;

var result = _audioController.UploadAudioFile(_projId, "not-a-user", _file).Result;
Assert.That(result, Is.InstanceOf<NotFoundObjectResult>());

result = _audioController.UploadAudioFile(_projId, "not-a-user", "speakerId", _file).Result;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result = _audioController.UploadAudioFile(_projId, "not-a-user", "speakerId", _file).Result;
result = _audioController.UploadAudioFile(_projId, "not-a-word", "speakerId", _file).Result;

{
var result = _audioController.DownloadAudioFile("invalid/projId", "wordId", "fileName");
var result = _audioController.DownloadAudioFile("invalid/projId", "fileName");
Assert.That(result, Is.TypeOf<UnsupportedMediaTypeResult>());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because all this code is so new to me and intriguing:
UnsupportedMediaType feels a bit confusing as a response type for invalid string identifiers. I'd expect a boring 400 with a message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Boring 400 perhaps makes more sense. I'm leaving it for now to be evaluated in all the controllers at the same time.

@imnasnainaec imnasnainaec merged commit 266cb4f into master Jun 5, 2025
17 checks passed
@imnasnainaec imnasnainaec deleted the audio-controller branch June 5, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audio backend maintenance Issue that makes it difficult to maintain the software or to upgrade installations post-release. test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants