Loading files
ca042f11dThis file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/openharness-1322671404.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.
ca042f11dThis file is pinned to the selected release. Download the original to open it in your design tool.
import { describe, expect, it, vi } from 'vitest'
// A deployment (or a test rig) that points the profile URL somewhere of its own turns the identity
// endpoint off with SSO_IDENTITY_URL='' — otherwise its tokens would be proved against the default host.
vi.mock('../config/env.js', () => ({
env: {
SSO_PROFILE_URL: 'http://127.0.0.1:4010/profile',
SSO_IDENTITY_URL: '',
SSO_PROFILE_TIMEOUT_MS: 1000,
SSO_PROFILE_CACHE_TTL_MS: 0,
},
}))
vi.mock('../services/UserService.js', () => ({
userService: {},
normalizeUserEmail: (email: string) => email,
isProvisionalUserEmail: () => false,
}))
import { fetchSsoProfile } from './ssoAuth.js'
describe('identity endpoint turned off', () => {
it('asks only the profile URL', async () => {
const fetchMock = vi.fn<typeof fetch>().mockImplementation(async () => new Response(
JSON.stringify({ status: 1, data: { id: 'external-1', email: 'user@example.com' } }),
{ status: 200, headers: { 'Content-Type': 'application/json' } },
))
await expect(fetchSsoProfile('token', fetchMock)).resolves.toEqual({ id: 'external-1', email: 'user@example.com' })
expect(fetchMock.mock.calls.map(([url]) => String(url))).toEqual(['http://127.0.0.1:4010/profile'])
})
})