Skip to content
This repository has been archived by the owner on Mar 1, 2023. It is now read-only.

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
nozomuikuta committed Nov 8, 2022
1 parent 98d333c commit 1f68ff1
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect, it, describe } from 'vitest'
import type { CompatibilityEvent } from 'h3'
import type { H3Event } from 'h3'
import { resolveCorsOptions, isPreflight, isAllowedOrigin, createOriginHeaders, createMethodsHeaders, createCredentialsHeaders, createAllowHeaderHeaders, createExposeHeaders, createMaxAgeHeader } from '../src/utils'
import type { CorsOptions } from '../src/types'

Expand Down Expand Up @@ -52,7 +52,7 @@ describe('isPreflight', () => {
'access-control-request-method': 'GET'
}
}
} as CompatibilityEvent
} as H3Event

expect(isPreflight(eventMock)).toEqual(true)
})
Expand All @@ -66,7 +66,7 @@ describe('isPreflight', () => {
'access-control-request-method': 'GET'
}
}
} as CompatibilityEvent
} as H3Event

expect(isPreflight(eventMock)).toEqual(false)
})
Expand All @@ -79,7 +79,7 @@ describe('isPreflight', () => {
'access-control-request-method': 'GET'
}
}
} as CompatibilityEvent
} as H3Event

expect(isPreflight(eventMock)).toEqual(false)
})
Expand All @@ -92,7 +92,7 @@ describe('isPreflight', () => {
origin: 'http://example.com'
}
}
} as CompatibilityEvent
} as H3Event

expect(isPreflight(eventMock)).toEqual(false)
})
Expand Down Expand Up @@ -180,7 +180,7 @@ describe('createOriginHeaders', () => {
origin: 'http://example.com'
}
}
} as CompatibilityEvent
} as H3Event
const options1: CorsOptions = {}
const options2: CorsOptions = {
origin: '*'
Expand All @@ -196,7 +196,7 @@ describe('createOriginHeaders', () => {
method: 'OPTIONS',
headers: {}
}
} as CompatibilityEvent
} as H3Event
const options: CorsOptions = {}

expect(createOriginHeaders(eventMock, options)).toEqual({ 'Access-Control-Allow-Origin': '*' })
Expand All @@ -210,7 +210,7 @@ describe('createOriginHeaders', () => {
origin: 'http://example.com'
}
}
} as CompatibilityEvent
} as H3Event
const options: CorsOptions = {
origin: 'null'
}
Expand All @@ -226,7 +226,7 @@ describe('createOriginHeaders', () => {
origin: 'http://example.com'
}
}
} as CompatibilityEvent
} as H3Event
const options1: CorsOptions = {
origin: ['http://example.com']
}
Expand Down Expand Up @@ -288,7 +288,7 @@ describe('createAllowHeaderHeaders', () => {
'access-control-request-headers': 'CUSTOM-HEADER'
}
}
} as CompatibilityEvent
} as H3Event
const options1: CorsOptions = {}
const options2: CorsOptions = {
allowHeaders: '*'
Expand All @@ -308,7 +308,7 @@ describe('createAllowHeaderHeaders', () => {
method: 'OPTIONS',
headers: {}
}
} as CompatibilityEvent
} as H3Event
const options: CorsOptions = {
allowHeaders: ['CUSTOM-HEADER']
}
Expand Down

0 comments on commit 1f68ff1

Please sign in to comment.