diff --git a/lib/app/static-assets.ts b/lib/app/static-assets.ts index 645059981..aadd00f0b 100644 --- a/lib/app/static-assets.ts +++ b/lib/app/static-assets.ts @@ -108,22 +108,3 @@ export async function setupStaticMiddleware(options: ServerOptions, router: Rout return createDefaultPugRequireHandler(options.staticRoot, staticManifest); } - -/** - * Gets the appropriate favicon filename based on the environment - * @param isDevMode - Whether the app is running in development mode - * @param env - The environment names array - * @returns The favicon filename to use - */ -export function getFaviconFilename(isDevMode: boolean, env?: string[]): string { - if (isDevMode) { - return 'favicon-dev.ico'; - } - if (env?.includes('beta')) { - return 'favicon-beta.ico'; - } - if (env?.includes('staging')) { - return 'favicon-staging.ico'; - } - return 'favicon.ico'; -} diff --git a/test/app/static-assets-tests.ts b/test/app/static-assets-tests.ts index 4e11cf95c..9904b8bc3 100644 --- a/test/app/static-assets-tests.ts +++ b/test/app/static-assets-tests.ts @@ -23,7 +23,7 @@ // POSSIBILITY OF SUCH DAMAGE. import {describe, expect, it, vi} from 'vitest'; -import {createDefaultPugRequireHandler, getFaviconFilename} from '../../lib/app/static-assets.js'; +import {createDefaultPugRequireHandler} from '../../lib/app/static-assets.js'; // Mock the logger vi.mock('../../lib/logger.js', () => ({ @@ -108,40 +108,4 @@ describe('Static assets', () => { } }); }); - - describe('getFaviconFilename', () => { - it('should prioritize dev environment over other environments', () => { - // Dev mode favicon should be used regardless of environment flags - expect(getFaviconFilename(true, [])).toContain('dev'); - expect(getFaviconFilename(true, ['beta'])).toContain('dev'); - expect(getFaviconFilename(true, ['staging'])).toContain('dev'); - expect(getFaviconFilename(true, ['beta', 'staging'])).toContain('dev'); - }); - - it('should select appropriate favicon based on environment', () => { - // Test specific environments when not in dev mode - const environments = [ - {env: ['beta'], expected: 'beta'}, - {env: ['staging'], expected: 'staging'}, - {env: [], expected: 'favicon.ico'}, - ]; - - for (const {env, expected} of environments) { - const result = getFaviconFilename(false, env); - if (expected === 'favicon.ico') { - expect(result).toBe(expected); - } else { - expect(result).toContain(expected); - } - } - }); - - it('should handle environment arrays with mixed values', () => { - // When multiple environments are specified, there should be a consistent priority - expect(getFaviconFilename(false, ['beta', 'staging'])).toContain('beta'); - expect(getFaviconFilename(false, ['staging', 'beta'])).toContain('beta'); - expect(getFaviconFilename(false, ['other', 'beta'])).toContain('beta'); - expect(getFaviconFilename(false, ['other', 'staging'])).toContain('staging'); - }); - }); });