forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TLC-674] New duplicate data service, object reducer tests
- Loading branch information
Showing
4 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/app/core/submission/submission-duplicate-data.service.spec.ts
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,30 @@ | ||
import { SubmissionDuplicateDataService } from './submission-duplicate-data.service'; | ||
import { FindListOptions } from '../data/find-list-options.model'; | ||
import { RequestParam } from '../cache/models/request-param.model'; | ||
|
||
/** | ||
* Basic tests for the submission-duplicate-data.service.ts service | ||
*/ | ||
describe('SubmissionDuplicateDataService', () => { | ||
const duplicateDataService = new SubmissionDuplicateDataService(null, null, null, null); | ||
|
||
// Test the findDuplicates method to make sure that a call results in an expected | ||
// call to searchBy, using the 'findByItem' search method | ||
describe('findDuplicates', () => { | ||
beforeEach(() => { | ||
spyOn(duplicateDataService, 'searchBy'); | ||
}); | ||
|
||
it('should call searchBy with the correct arguments', () => { | ||
// Set up expected search parameters and find options | ||
const searchParams = []; | ||
searchParams.push(new RequestParam('uuid', 'test')); | ||
let findListOptions = new FindListOptions(); | ||
findListOptions.searchParams = searchParams; | ||
// Perform test search using uuid 'test' using the findDuplicates method | ||
const result = duplicateDataService.findDuplicates('test', new FindListOptions(), true, true); | ||
// Expect searchBy('findByItem'...) to have been used as SearchData impl with the expected options (uuid=test) | ||
expect(duplicateDataService.searchBy).toHaveBeenCalledWith('findByItem', findListOptions, true, true); | ||
}); | ||
}); | ||
}); |
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