-
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.
tech(api): use organizationId instead of id
- Loading branch information
Showing
4 changed files
with
25 additions
and
21 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
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 |
---|---|---|
|
@@ -11,6 +11,7 @@ const supOrganizationLearnerImportHeader = new SupOrganizationLearnerImportHeade | |
.join(';'); | ||
|
||
describe('Unit | UseCase | ReplaceSupOrganizationLearner', function () { | ||
let organizationImportId; | ||
const organizationId = 1234; | ||
const userId = 333; | ||
let organizationImport, | ||
|
@@ -20,18 +21,21 @@ describe('Unit | UseCase | ReplaceSupOrganizationLearner', function () { | |
expectedLearners; | ||
|
||
beforeEach(function () { | ||
organizationImportId = Symbol('organizationImportId'); | ||
organizationImport = new OrganizationImport({ | ||
id: organizationImportId, | ||
filename: 'file.csv', | ||
organizationId, | ||
createdBy: userId, | ||
encoding: 'utf-8', | ||
}); | ||
supOrganizationLearnerRepositoryStub = { replaceStudents: sinon.stub().resolves() }; | ||
organizationImportRepositoryStub = { | ||
getLastByOrganizationId: sinon.stub().withArgs(organizationId).resolves(organizationImport), | ||
get: sinon.stub(), | ||
save: sinon.stub(), | ||
}; | ||
|
||
organizationImportRepositoryStub.get.withArgs(organizationImportId).resolves(organizationImport); | ||
importStorageStub = { | ||
readFile: sinon.stub(), | ||
deleteFile: sinon.stub(), | ||
|
@@ -84,7 +88,7 @@ describe('Unit | UseCase | ReplaceSupOrganizationLearner', function () { | |
|
||
// when | ||
await replaceSupOrganizationLearners({ | ||
organizationId, | ||
organizationImportId, | ||
i18n, | ||
supOrganizationLearnerRepository: supOrganizationLearnerRepositoryStub, | ||
organizationImportRepository: organizationImportRepositoryStub, | ||
|
@@ -110,7 +114,7 @@ describe('Unit | UseCase | ReplaceSupOrganizationLearner', function () { | |
|
||
// when | ||
await replaceSupOrganizationLearners({ | ||
organizationId, | ||
organizationImportId, | ||
i18n, | ||
supOrganizationLearnerRepository: supOrganizationLearnerRepositoryStub, | ||
organizationImportRepository: organizationImportRepositoryStub, | ||
|
@@ -134,7 +138,7 @@ describe('Unit | UseCase | ReplaceSupOrganizationLearner', function () { | |
|
||
// when | ||
await replaceSupOrganizationLearners({ | ||
organizationId, | ||
organizationImportId, | ||
supOrganizationLearnerRepository: supOrganizationLearnerRepositoryStub, | ||
importStorage: importStorageStub, | ||
organizationImportRepository: organizationImportRepositoryStub, | ||
|
@@ -149,7 +153,7 @@ describe('Unit | UseCase | ReplaceSupOrganizationLearner', function () { | |
|
||
describe('errors case', function () { | ||
beforeEach(function () { | ||
organizationImportRepositoryStub.getLastByOrganizationId.withArgs(organizationId).resolves(organizationImport); | ||
organizationImportRepositoryStub.get.withArgs(organizationImportId).resolves(organizationImport); | ||
|
||
const csvContent = `${supOrganizationLearnerImportHeader} | ||
Beatrix;The;Bride;Kiddo;Black Mamba;01/01/1970;[email protected];123456;Assassination Squad;Hattori Hanzo;Deadly Viper Assassination Squad;BAD;BAD; | ||
|
@@ -165,7 +169,7 @@ describe('Unit | UseCase | ReplaceSupOrganizationLearner', function () { | |
|
||
// when | ||
await catchErr(replaceSupOrganizationLearners)({ | ||
organizationId, | ||
organizationImportId, | ||
i18n, | ||
supOrganizationLearnerRepository: supOrganizationLearnerRepositoryStub, | ||
organizationImportRepository: organizationImportRepositoryStub, | ||
|