Skip to content

Commit

Permalink
⬆️ (auth-js): update @auth/core dependency from version ^0.30.0 to ^0…
Browse files Browse the repository at this point in the history
….35.3 for latest features and bug fixes

✅ (index.test.ts): add basePath to config for consistency in authentication tests
♻️ (index.test.ts): correct code style inconsistencies for better readability and maintainability
  • Loading branch information
kodermax committed Oct 4, 2024
1 parent a428a5f commit 29d05aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/auth-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"react": ">=18"
},
"devDependencies": {
"@auth/core": "^0.30.0",
"@auth/core": "^0.35.3",
"@types/react": "^18",
"hono": "^3.11.7",
"jest": "^29.7.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/auth-js/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { skipCSRFCheck } from '@auth/core'
import type { Adapter } from '@auth/core/adapters'
import Credentials from '@auth/core/providers/credentials'
import { Hono } from 'hono'
import { describe, expect, it, vi } from "vitest"
import { describe, expect, it, vi } from 'vitest'
import type { AuthConfig } from '../src'
import { authHandler, verifyAuth, initAuthConfig, reqWithEnvUrl } from '../src'

Expand Down Expand Up @@ -39,6 +39,7 @@ describe('Config', () => {
'/*',
initAuthConfig(() => {
return {
basePath: '/api/auth',
providers: [],
}
})
Expand Down Expand Up @@ -78,7 +79,7 @@ describe('Config', () => {
})
})

describe('reqWithEnvUrl()', async() => {
describe('reqWithEnvUrl()', async () => {
const req = new Request('http://request-base/request-path')
const newReq = await reqWithEnvUrl(req, 'https://auth-url-base/auth-url-path')
it('Should rewrite the base path', () => {
Expand Down Expand Up @@ -126,7 +127,6 @@ describe('Credentials Provider', () => {
password: {},
},
authorize: (credentials) => {

if (credentials.password === 'password') {
return user
}
Expand Down Expand Up @@ -193,12 +193,12 @@ describe('Credentials Provider', () => {

it('Should respect x-forwarded-proto and x-forwarded-host', async () => {
const headers = new Headers()
headers.append('x-forwarded-proto', "https")
headers.append('x-forwarded-host', "example.com")
headers.append('x-forwarded-proto', 'https')
headers.append('x-forwarded-host', 'example.com')
const res = await app.request('http://localhost/api/auth/signin', {
headers,
})
let html = await res.text()
expect(html).toContain('action="https://example.com/api/auth/callback/credentials"')
})
})
})

0 comments on commit 29d05aa

Please sign in to comment.