|
4 | 4 | createWorkdaySoapClient, |
5 | 5 | extractRefId, |
6 | 6 | } from '@/lib/internal/workday/client' |
| 7 | +import { executeWorkdayGetOrganizations } from '@/lib/internal/workday/operations' |
7 | 8 |
|
8 | 9 | const SUCCESS_RESPONSE = `<?xml version="1.0" encoding="UTF-8"?> |
9 | 10 | <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wd="urn:com.workday/bsvc"> |
@@ -39,6 +40,31 @@ describe('Workday SOAP client', () => { |
39 | 40 | ) |
40 | 41 | }) |
41 | 42 |
|
| 43 | + it('sends Get_Organizations criteria before the response filter, in schema order', async () => { |
| 44 | + fetchMock.mockResolvedValue( |
| 45 | + new Response( |
| 46 | + '<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wd="urn:com.workday/bsvc"><env:Body><wd:Get_Organizations_Response/></env:Body></env:Envelope>', |
| 47 | + { status: 200 } |
| 48 | + ) |
| 49 | + ) |
| 50 | + |
| 51 | + await executeWorkdayGetOrganizations({ |
| 52 | + tenantUrl: 'https://wd2-impl-services1.workday.com', |
| 53 | + tenant: 'example', |
| 54 | + username: 'user', |
| 55 | + password: 'password', |
| 56 | + type: 'Supervisory', |
| 57 | + }) |
| 58 | + |
| 59 | + const body = String(fetchMock.mock.calls[0]?.[1]?.body) |
| 60 | + const criteria = body.indexOf('<wd:Request_Criteria>') |
| 61 | + const filter = body.indexOf('<wd:Response_Filter>') |
| 62 | + const group = body.indexOf('<wd:Response_Group>') |
| 63 | + expect(criteria).toBeGreaterThan(-1) |
| 64 | + expect(criteria).toBeLessThan(filter) |
| 65 | + expect(filter).toBeLessThan(group) |
| 66 | + }) |
| 67 | + |
42 | 68 | it('passes cancellation to fetch, escapes XML, and parses SOAP responses', async () => { |
43 | 69 | fetchMock.mockResolvedValue(new Response(SUCCESS_RESPONSE, { status: 200 })) |
44 | 70 | const controller = new AbortController() |
|
0 commit comments