generated from silverbulletmd/silverbullet-plug-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from justyns/use-space-config
Fix failing tests
- Loading branch information
Showing
5 changed files
with
17 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | ||
import "./mocks/syscalls.ts"; | ||
import { aiSettings, getAndConfigureModel, initializeOpenAI } from "./init.ts"; | ||
import { syscall } from "@silverbulletmd/silverbullet/syscalls"; | ||
|
||
const settingsPageSample = ` | ||
Mock settings, yay | ||
|
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { parse as parseYAML } from "https://deno.land/[email protected]/yaml/mod.ts"; | ||
import { parseMarkdown } from "$common/markdown_parser/parser.ts"; | ||
import { syscall } from "@silverbulletmd/silverbullet/syscalls"; | ||
import { readSetting } from "https://deno.land/x/[email protected]/plug-api/lib/settings_page.ts"; | ||
|
||
let editorText = "Mock data"; | ||
(globalThis as any).editorText; | ||
|
@@ -14,10 +15,13 @@ let currentEnv: string = "server"; | |
let clientStore: { [key: string]: string } = {}; | ||
(globalThis as any).clientStore; | ||
|
||
let spaceConfig = {}; | ||
(globalThis as any).spaceConfig; | ||
|
||
// let indexedObjects: { [key: string]: string } = {}; | ||
// (globalThis as any).indexedObjects; | ||
|
||
globalThis.syscall = async (name: string, ...args: readonly any[]) => { | ||
(globalThis as any).syscall = async (name: string, ...args: readonly any[]) => { | ||
switch (name) { | ||
// I tried a lot of things to get this working differently, but | ||
// ended up with just keeping this in a variable that can be changed | ||
|
@@ -58,6 +62,14 @@ globalThis.syscall = async (name: string, ...args: readonly any[]) => { | |
case "clientStore.get": | ||
return clientStore[args[0]]; | ||
|
||
// hack to ignore space config in tests for now | ||
case "system.setSpaceConfig": | ||
spaceConfig = args[0]; | ||
break; | ||
case "system.getSpaceConfig": | ||
return readSetting(args[0], args[1]); | ||
// return spaceConfig; | ||
|
||
default: | ||
throw Error(`Missing mock for: ${name}`); | ||
} | ||
|
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 |
---|---|---|
|
@@ -2,6 +2,7 @@ import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | |
import "./mocks/syscalls.ts"; | ||
import { convertPageToMessages, log } from "./utils.ts"; | ||
import { folderName } from "./utils.ts"; | ||
import { syscall } from "@silverbulletmd/silverbullet/syscalls"; | ||
import { ChatMessage } from "./types.ts"; | ||
|
||
Deno.test("folderName should return the correct folder path", () => { | ||
|
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