Skip to content

Commit fdcb1ea

Browse files
committed
Add test for the validation
1 parent d8aea0c commit fdcb1ea

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

test/unitTests/Packages/isValidDownload.test.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,22 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import { isValidDownload } from "../../../src/packageManager/isValidDownload";
7-
import { createTestFile } from "../testAssets/TestFile";
8-
import TestZip from "../testAssets/TestZip";
97
import * as chai from "chai";
108

119
chai.should();
1210
const expect = chai.expect;
1311

1412
suite(`${isValidDownload.name}`, () => {
15-
const files = [
16-
createTestFile("file1", "file1.txt"),
17-
createTestFile("file2", "file2.txt")
18-
];
19-
20-
let testZip: TestZip;
21-
22-
setup(async() => {
23-
testZip = await TestZip.createTestZipAsync(...files);
24-
});
13+
const sampleBuffer = Buffer.from("sampleBuffer");
14+
const validIntegrity = "eb7201b5d986919e0ac67c820886358869d8f7059193d33c902ad7fe1688e1e9";
2515

2616
test('Returns false for non-matching integrity', async () => {
27-
let result = await isValidDownload(testZip.buffer, "inValidIntegrity");
17+
let result = await isValidDownload(sampleBuffer, "inValidIntegrity");
2818
expect(result).to.be.false;
2919
});
3020

3121
test('Returns true for matching integrity', async () => {
32-
let result = await isValidDownload(testZip.buffer, "212785b9cf15888785ed55a9357b4c4e29d0acca6a978ccb1df7cc8ee7423071");
22+
let result = await isValidDownload(sampleBuffer, validIntegrity);
3323
expect(result).to.be.true;
3424
});
3525
});

0 commit comments

Comments
 (0)