Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions tests/unit/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,11 @@ describe('NetbootXYZ WebApp', () => {
});

test('should handle binary file detection', async () => {
const { isBinaryFile } = require('isbinaryfile');

// Mock binary file detection
// Mock binary file detection (isbinaryfile is ESM-only, so mock directly)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CRITICAL: Test is not testing any application code

While the comment explains why the import was removed (ESM-only module), the resulting test has a fundamental flaw: it creates a mock function and then calls the mock directly (lines 180-181), which means it's only testing that the mock returns what it was configured to return.

This is a tautological test that provides no value. The test should either:

  1. Mock isbinaryfile at the module level and test actual application code that uses it
  2. Be removed entirely if binary file detection is not actually used in the application
  3. Be converted to an integration test that tests the actual binary file detection behavior

Currently, this test will always pass regardless of whether binary file detection works correctly in the application.

const mockIsBinaryFile = jest.fn()
.mockResolvedValueOnce(true) // Binary file
.mockResolvedValueOnce(false); // Text file

require('isbinaryfile').isBinaryFile = mockIsBinaryFile;

const data = Buffer.from('test content');
const stat = { size: data.length };

Expand Down
Loading