Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/base/test/node/crypto.test.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import * as fs from 'fs';
7
import { tmpdir } from 'os';
8
import { join } from '../../common/path.js';
9
import { checksum } from '../../node/crypto.js';
10
import { Promises } from '../../node/pfs.js';
11
import { ensureNoDisposablesAreLeakedInTestSuite } from '../common/utils.js';
12
import { flakySuite, getRandomTestPath } from './testUtils.js';
13
14
flakySuite('Crypto', () => {
15
16
let testDir: string;
17
18
ensureNoDisposablesAreLeakedInTestSuite();
19
20
setup(function () {
21
testDir = getRandomTestPath(tmpdir(), 'vsctests', 'crypto');
22
23
return fs.promises.mkdir(testDir, { recursive: true });
24
});
25
26
teardown(function () {
27
return Promises.rm(testDir);
28
});
29
30
test('checksum', async () => {
31
const testFile = join(testDir, 'checksum.txt');
32
await Promises.writeFile(testFile, 'Hello World');
33
34
await checksum(testFile, 'a591a6d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e');
35
});
36
});
37
38