-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Affiche lien pour consulter document
- Loading branch information
Showing
11 changed files
with
79 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const documentRecu = (depotDonnees, reponse) => depotDonnees | ||
.documentRecu() | ||
.then((document) => { | ||
reponse.set({ 'content-type': 'application/pdf; charset=utf-8' }); | ||
reponse.send(document); | ||
}); | ||
|
||
module.exports = documentRecu; |
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
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const documentRecu = require('../../src/api/documentRecu'); | ||
|
||
describe('Le requêteur du document reçu', () => { | ||
const depotDonnees = {}; | ||
const reponse = {}; | ||
|
||
beforeEach(() => { | ||
depotDonnees.documentRecu = () => Promise.resolve(Buffer.from('')); | ||
reponse.set = () => {}; | ||
reponse.send = () => {}; | ||
}); | ||
|
||
it('demande le document au dépôt de donnés', () => { | ||
let depotDonneesAppele = false; | ||
depotDonnees.documentRecu = () => { | ||
depotDonneesAppele = true; | ||
return Promise.resolve(Buffer.from('')); | ||
}; | ||
|
||
return documentRecu(depotDonnees, reponse) | ||
.then(() => expect(depotDonneesAppele).toBe(true)); | ||
}); | ||
|
||
it('renvoie le document reçu', () => { | ||
expect.assertions(1); | ||
|
||
depotDonnees.documentRecu = () => Promise.resolve(Buffer.from('Un document')); | ||
reponse.send = (document) => expect(document.toString()).toBe('Un document'); | ||
|
||
return documentRecu(depotDonnees, reponse); | ||
}); | ||
}); |
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