diff --git a/src/repositories/baseOrgRepository.js b/src/repositories/baseOrgRepository.js index f1b8c2aa4..e9793d9bf 100644 --- a/src/repositories/baseOrgRepository.js +++ b/src/repositories/baseOrgRepository.js @@ -595,8 +595,6 @@ class BaseOrgRepository extends BaseRepository { // Write - use org type specific model if (registryObjectRaw.authority.includes('SECRETARIAT')) { // Write - // testing: - registryObjectRaw.authority = 'SECRETARIAT' const SecretariatObjectToSave = new SecretariatOrgModel(registryObjectRaw) if (isSecretariat) { registryObject = await SecretariatObjectToSave.save(options) diff --git a/test/integration-tests/audit/registryOrgCreatesAuditTest.js b/test/integration-tests/audit/registryOrgCreatesAuditTest.js index d9777c1d8..a2792dcb7 100644 --- a/test/integration-tests/audit/registryOrgCreatesAuditTest.js +++ b/test/integration-tests/audit/registryOrgCreatesAuditTest.js @@ -73,6 +73,20 @@ describe('Create and Update Audit Collection with Org Endpoints', () => { expect(auditObject.UUID).to.equal(org.uuid) }) + it('Should keep Secretariat audit authority consistent with stored org authority', async () => { + const org = await createTestOrg({ + authority: ['SECRETARIAT'] + }) + + const auditRes = await chai.request(app) + .get(`/api/audit/org/${org.uuid}`) + .set(constants.headers) + + expect(auditRes).to.have.status(200) + expect(auditRes.body.history).to.be.an('array').with.lengthOf(1) + expect(auditRes.body.history[0].audit_object.authority).to.deep.equal(['SECRETARIAT']) + }) + it('Should create separate audit documents for multiple orgs', async () => { // Create multiple orgs const [org1, org2, org3] = await Promise.all([