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
31 changes: 31 additions & 0 deletions clients/LedgerClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,37 @@ describe('LedgerClient', () => {
})
})

describe('listUnmappedElements', () => {
it('names the concept a contra account nets against', async () => {
mockFetch.mockResolvedValueOnce(
gqlResponse({
unmappedElements: [
{
id: 'elem_3',
code: '1420',
name: 'Accumulated Amortization',
trait: 'contraAsset',
balanceType: 'credit',
externalSource: 'qb',
suggestedTargets: [],
netsAgainst: {
elementId: 'elem_intangibles',
qname: 'rs-gaap:IntangibleAssetsNetExcludingGoodwill',
name: 'Intangible Assets, Net (Excluding Goodwill)',
confidence: null,
},
},
],
})
)
const [contra] = await client.listUnmappedElements('graph_1', { mappingId: 'map_1' })
expect(contra.netsAgainst?.qname).toBe('rs-gaap:IntangibleAssetsNetExcludingGoodwill')
const body = JSON.parse((mockFetch.mock.calls[0][1] as RequestInit).body as string)
expect(body.query).toContain('netsAgainst')
expect(body.variables.mappingId).toBe('map_1')
})
})

describe('getAccountRegister', () => {
it('forwards the account, window, slice and cursor', async () => {
mockFetch.mockResolvedValueOnce(
Expand Down
19 changes: 19 additions & 0 deletions clients/graphql/generated/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2729,6 +2729,12 @@ export type ListLedgerUnmappedElementsQuery = {
name: string
confidence: number | null
}>
netsAgainst: {
elementId: string
qname: string
name: string
confidence: number | null
} | null
}>
}

Expand Down Expand Up @@ -10629,6 +10635,19 @@ export const ListLedgerUnmappedElementsDocument = {
],
},
},
{
kind: 'Field',
name: { kind: 'Name', value: 'netsAgainst' },
selectionSet: {
kind: 'SelectionSet',
selections: [
{ kind: 'Field', name: { kind: 'Name', value: 'elementId' } },
{ kind: 'Field', name: { kind: 'Name', value: 'qname' } },
{ kind: 'Field', name: { kind: 'Name', value: 'name' } },
{ kind: 'Field', name: { kind: 'Name', value: 'confidence' } },
],
},
},
],
},
},
Expand Down
6 changes: 6 additions & 0 deletions clients/graphql/queries/ledger/unmappedElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ export const LIST_UNMAPPED_ELEMENTS = gql`
name
confidence
}
netsAgainst {
elementId
qname
name
confidence
}
}
}
`