1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-29 13:38:46 +00:00
code-server-2/packages/protocol/test/trash.test.ts
2019-04-24 18:15:56 -05:00

30 lines
686 B
TypeScript

import * as fs from "fs";
import * as util from "util";
import { Module } from "../src/common/proxy";
import { createClient, Helper } from "./helpers";
// tslint:disable deprecation to use fs.exists
describe("trash", () => {
const client = createClient();
const trash = client.modules[Module.Trash];
const helper = new Helper("trash");
beforeAll(async () => {
await helper.prepare();
});
it("should trash a file", async () => {
const file = await helper.createTmpFile();
await trash.trash(file);
expect(await util.promisify(fs.exists)(file)).toBeFalsy();
});
it("should dispose", (done) => {
setTimeout(() => {
client.dispose();
done();
}, 100);
});
});