Display differential download size in UI
This commit is contained in:
parent
052a8e65e2
commit
29c2f77d40
9 changed files with 320 additions and 151 deletions
|
@ -12,6 +12,7 @@ import {
|
|||
computeDiff,
|
||||
getBlockMapFileName,
|
||||
prepareDownload,
|
||||
isValidPreparedData,
|
||||
download,
|
||||
} from '../../updater/differential';
|
||||
|
||||
|
@ -143,6 +144,49 @@ describe('updater/differential', () => {
|
|||
]);
|
||||
});
|
||||
|
||||
it('checks that the data is valid to facilitate caching', async () => {
|
||||
const oldFilePath = path.join(FIXTURES, oldFile);
|
||||
const newUrl = `${baseUrl}/${newFile}`;
|
||||
|
||||
const data = await prepareDownload({
|
||||
oldFile: oldFilePath,
|
||||
newUrl,
|
||||
sha512: newHash,
|
||||
});
|
||||
|
||||
assert.isTrue(
|
||||
isValidPreparedData(data, {
|
||||
oldFile: oldFilePath,
|
||||
newUrl,
|
||||
sha512: newHash,
|
||||
})
|
||||
);
|
||||
|
||||
assert.isFalse(
|
||||
isValidPreparedData(data, {
|
||||
oldFile: 'different file',
|
||||
newUrl,
|
||||
sha512: newHash,
|
||||
})
|
||||
);
|
||||
|
||||
assert.isFalse(
|
||||
isValidPreparedData(data, {
|
||||
oldFile: oldFilePath,
|
||||
newUrl: 'different url',
|
||||
sha512: newHash,
|
||||
})
|
||||
);
|
||||
|
||||
assert.isFalse(
|
||||
isValidPreparedData(data, {
|
||||
oldFile: oldFilePath,
|
||||
newUrl,
|
||||
sha512: 'different hash',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
it('downloads the file', async () => {
|
||||
const data = await prepareDownload({
|
||||
oldFile: path.join(FIXTURES, oldFile),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue