-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c489ce4
commit a6af672
Showing
15 changed files
with
694 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { defineConfig } = require('@vscode/test-cli'); | ||
|
||
module.exports = defineConfig({ files: 'lib/**/*.test.js' }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as assert from "assert"; | ||
import { afterEach } from "mocha"; | ||
import { mock } from "node:test"; | ||
import { resolve } from "path"; | ||
import * as vscode from "vscode"; | ||
import { generate } from "./generate.js"; | ||
import { SETTINGS } from "./settings.js"; | ||
const { assertExists } = require("@davidsouther/jiffies/lib/cjs/assert.js"); | ||
|
||
async function activate(docUri: vscode.Uri) { | ||
const ext = vscode.extensions.getExtension("davidsouther.ailly"); | ||
await ext?.activate(); | ||
const doc = await vscode.workspace.openTextDocument(docUri); | ||
const editor = await vscode.window.showTextDocument(doc); | ||
return { doc, editor }; | ||
} | ||
|
||
process.env["AILLY_ENGINE"] = "noop"; | ||
process.env["AILLY_NOOP_RESPONSE"] = "Edited"; | ||
process.env["AILLY_NOOP_TIMEOUT"] = "0"; | ||
process.env["AILLY_NOOP_STREAM"] = ""; | ||
|
||
suite("Ailly Extension Generate", () => { | ||
afterEach(() => | ||
vscode.commands.executeCommand("workbench.action.closeActiveEditor") | ||
); | ||
|
||
test("generate edit", async () => { | ||
const path = resolve(__dirname, "..", "testing", "edit.txt"); | ||
const docUri = vscode.Uri.file(path); | ||
await activate(docUri); | ||
mock.method(SETTINGS, "getAillyEngine", () => "noop"); | ||
|
||
await generate(path, { prompt: "Replace with Edited", start: 1, end: 3 }); | ||
// await new Promise((r) => setTimeout(r, 2000)); | ||
|
||
const activeWindow = assertExists(vscode.window.activeTextEditor); | ||
assert.equal(activeWindow.document.getText(), "Line 1\nEdited\nLine 4"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.