add a test
This commit is contained in:
parent
5ff92c6452
commit
527e9f09c9
3 changed files with 29 additions and 5 deletions
|
@ -134,6 +134,27 @@ describe('Upload / Download flow', function() {
|
|||
}
|
||||
});
|
||||
|
||||
it('can cancel and not increase download count', async function() {
|
||||
const fs = new FileSender(blob);
|
||||
const file = await fs.upload();
|
||||
const fr = new FileReceiver({
|
||||
secretKey: file.toJSON().secretKey,
|
||||
id: file.id,
|
||||
nonce: file.keychain.nonce,
|
||||
requiresPassword: false
|
||||
});
|
||||
await fr.getMetadata();
|
||||
fr.once('progress', () => fr.cancel());
|
||||
|
||||
try {
|
||||
await fr.download(noSave);
|
||||
assert.fail('not cancelled');
|
||||
} catch (e) {
|
||||
await file.updateDownloadCount();
|
||||
assert.equal(file.dtotal, 0);
|
||||
}
|
||||
});
|
||||
|
||||
it('can allow multiple downloads', async function() {
|
||||
const fs = new FileSender(blob);
|
||||
const file = await fs.upload();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue