BEGIN;
SELECT plan(1);
INSERT INTO authority.record_entry (id, marc, last_xact_id)
VALUES (999999100, $$
01601cz a2200289n 4500
Doe, Jane
nnnc
Alias, Annie
999999101
nnnc
Pen-name, Penny
999999102
$$, 'test'),
(999999101, $$
01601cz a2200289n 4500
Alias, Annie
nnnc
Doe, Jane
999999100
$$, 'test'),
(999999102, $$
01601cz a2200289n 4500
Pen-name, Penny
nnnc
Doe, Jane
999999100
$$, 'test');
SELECT is(
ARRAY(
SELECT (authority.calculate_authority_linking(id, 1, marc::XML)).target
FROM authority.record_entry
WHERE id = 999999100
ORDER BY 1
),
ARRAY[ 999999101::BIGINT, 999999102::BIGINT ],
'retrieve all of the links to other authority records'
);
ROLLBACK;