@@ -2,6 +2,7 @@ import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest'
22import sharp , { type Metadata } from 'sharp'
33import toIco from 'to-ico'
44import { writeFile } from 'fs/promises'
5+ import { UnitTestError } from '@test/errors'
56
67// Mock external dependencies
78vi . mock ( 'sharp' )
@@ -35,7 +36,7 @@ describe('favicon.ts', () => {
3536 // Since generateIcoFavicon is not exported, we'll create a local test
3637 const generateIcoFavicon = ( { width, height, density } : Partial < Metadata > ) => {
3738 if ( ! width || ! height || ! density ) {
38- throw new Error ( `Required option not passed to generateIcoFavicon` )
39+ throw new UnitTestError ( `Required option not passed to generateIcoFavicon` )
3940 }
4041 }
4142
@@ -47,7 +48,7 @@ describe('favicon.ts', () => {
4748 it ( 'should throw error when height is missing' , ( ) => {
4849 const generateIcoFavicon = ( { width, height, density } : Partial < Metadata > ) => {
4950 if ( ! width || ! height || ! density ) {
50- throw new Error ( `Required option not passed to generateIcoFavicon` )
51+ throw new UnitTestError ( `Required option not passed to generateIcoFavicon` )
5152 }
5253 }
5354 const metadata : Partial < Metadata > = { width : 512 , density : 72 }
@@ -60,7 +61,7 @@ describe('favicon.ts', () => {
6061 it ( 'should throw error when density is missing' , ( ) => {
6162 const generateIcoFavicon = ( { width, height, density } : Partial < Metadata > ) => {
6263 if ( ! width || ! height || ! density ) {
63- throw new Error ( `Required option not passed to generateIcoFavicon` )
64+ throw new UnitTestError ( `Required option not passed to generateIcoFavicon` )
6465 }
6566 }
6667 const metadata : Partial < Metadata > = { width : 512 , height : 512 }
@@ -111,7 +112,7 @@ describe('favicon.ts', () => {
111112 it ( 'should throw error when required parameters are missing' , ( ) => {
112113 const generatePngFavicon = ( { width, height, density } : Partial < Metadata > ) => {
113114 if ( ! width || ! height || ! density ) {
114- throw new Error ( `Required option not passed to generatePngFavicon` )
115+ throw new UnitTestError ( `Required option not passed to generatePngFavicon` )
115116 }
116117 }
117118
0 commit comments