-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(api): move and rework archive-organization tests
- Loading branch information
Showing
8 changed files
with
105 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
.../organizational-entities/integration/domain/usecases/archive-organization.usecase.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { usecases } from '../../../../../src/organizational-entities/domain/usecases/index.js'; | ||
import { databaseBuilder, expect, sinon } from '../../../../test-helper.js'; | ||
|
||
describe('Integration | Organizational Entities | Domain | UseCase | archive-organization', function () { | ||
it('archives the organization', async function () { | ||
// given | ||
const now = new Date('2022-02-22'); | ||
const clock = sinon.useFakeTimers({ now, toFake: ['Date'] }); | ||
const superAdminUser = databaseBuilder.factory.buildUser(); | ||
const organization = databaseBuilder.factory.buildOrganization(); | ||
await databaseBuilder.commit(); | ||
|
||
// when | ||
const archivedOrganization = await usecases.archiveOrganization({ | ||
organizationId: organization.id, | ||
userId: superAdminUser.id, | ||
}); | ||
|
||
// then | ||
expect(archivedOrganization.archivedAt).to.deep.equal(now); | ||
expect(archivedOrganization.archivistFirstName).to.deep.equal(superAdminUser.firstName); | ||
expect(archivedOrganization.archivistLastName).to.deep.equal(superAdminUser.lastName); | ||
|
||
clock.restore(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
api/tests/unit/domain/usecases/archive-organization_test.js
This file was deleted.
Oops, something went wrong.