Skip to content

Commit

Permalink
fix build error and add test to catch
Browse files Browse the repository at this point in the history
  • Loading branch information
kkartch0 committed Dec 14, 2024
1 parent 0a702d9 commit e2e66f9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/gospelStudyPluginSettingTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import GospelStudyPlugin from "./main";
import { App, MarkdownRenderer, PluginSettingTab, Setting } from "obsidian";
import { StudyBlockData } from "./models/StudyBlockData";
import { getStudyBlockDataFromStudyData } from "./getStudyBlockFromStudyData";
import { createStudyBlock } from "./createStudyBlock";

export class GospelStudyPluginSettingTab extends PluginSettingTab {
public plugin: GospelStudyPlugin;
formats: string[];
studyBlock!: StudyBlockData | null;
studyBlockData!: StudyBlockData | null;

public constructor(app: App, plugin: GospelStudyPlugin) {
super(app, plugin);
Expand All @@ -17,7 +18,7 @@ export class GospelStudyPluginSettingTab extends PluginSettingTab {
}

public async initSampleStudyBlockText() {
this.studyBlock = await getStudyBlockDataFromStudyData("https://www.churchofjesuschrist.org/study/scriptures/nt/john/3?lang=eng&id=p16-p17#p16");
this.studyBlockData = await getStudyBlockDataFromStudyData("https://www.churchofjesuschrist.org/study/scriptures/nt/john/3?lang=eng&id=p16-p17#p16");
}

public display(): void {
Expand Down Expand Up @@ -128,9 +129,12 @@ export class GospelStudyPluginSettingTab extends PluginSettingTab {

private renderBlockFormatPreview(parentDiv: HTMLDivElement) {
parentDiv.empty();
if (!this.studyBlockData) {
return;
}
MarkdownRenderer.render(
this.app,
this.studyBlock?.toString(this.plugin.settings) ?? "",
createStudyBlock(this.studyBlockData, this.plugin.settings) ?? "",
parentDiv,
'',
this.plugin
Expand Down
7 changes: 7 additions & 0 deletions test/build.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { execSync } from "child_process"

describe("npm run build", () => {
it("should build without errors", () => {
execSync("npm run build");
})
})

0 comments on commit e2e66f9

Please sign in to comment.