Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
767 changes: 762 additions & 5 deletions apps/docs/content/docs/en/integrations/okta.mdx

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions apps/sim/blocks/blocks/okta.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* @vitest-environment node
*/
import { describe, expect, it } from 'vitest'
import { OktaBlock } from '@/blocks/blocks/okta'

/**
* The generic block handler runs `{ ...inputs, ...transformedParams }`, so the
* transform can only drop a value by assigning `undefined` to its key. Omitting
* the key leaves the raw subBlock string in place. These cases pin that
* behavior by asserting on the merge, not on the transform alone.
*/
function merge(inputs: Record<string, unknown>): Record<string, unknown> {
const transform = OktaBlock.tools.config?.params
if (!transform) throw new Error('Okta block has no params transform')
return { ...inputs, ...transform(inputs) }
}

const BASE = { operation: 'okta_list_users', apiKey: 'token', domain: 'dev-1.okta.com' }

describe('Okta block params transform', () => {
it('coerces a numeric limit', () => {
expect(merge({ ...BASE, limit: '25' }).limit).toBe(25)
})

it('drops a non-numeric limit rather than forwarding the raw entry', () => {
expect(merge({ ...BASE, limit: 'twenty' }).limit).toBeUndefined()
})

it('drops a non-numeric priority rather than forwarding the raw entry', () => {
const merged = merge({
...BASE,
operation: 'okta_assign_group_to_app',
priority: 'high',
})
expect(merged.priority).toBeUndefined()
})

it('drops a blank profile field so a partial update leaves Okta untouched', () => {
const merged = merge({
...BASE,
operation: 'okta_update_user',
userId: '00u1',
firstName: 'Ada',
lastName: '',
})
expect(merged.firstName).toBe('Ada')
expect(merged.lastName).toBeUndefined()
})

it('maps the group name and description onto the tool param names', () => {
const merged = merge({
...BASE,
operation: 'okta_create_group',
groupName: 'Engineering',
groupDescription: 'Eng team',
})
expect(merged.name).toBe('Engineering')
expect(merged.description).toBe('Eng team')
})

it('keeps a false toggle, which is a real choice rather than a blank field', () => {
const merged = merge({
...BASE,
operation: 'okta_activate_user',
userId: '00u1',
sendEmail: false,
})
expect(merged.sendEmail).toBe(false)
})
})

describe('Okta block outputs', () => {
it('declares only fields a tool emits at the top level', () => {
const declared = Object.keys(OktaBlock.outputs)
expect(declared).not.toContain('targets')
expect(declared).not.toContain('debugData')
expect(declared).toContain('events')
})
})
Loading
Loading