generated from obsidianmd/obsidian-sample-plugin
-
Notifications
You must be signed in to change notification settings - Fork 36
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
60d18cd
commit 30e5bfa
Showing
12 changed files
with
179 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,7 @@ package-lock.json | |
|
||
# obsidian | ||
data.json | ||
|
||
# Tests | ||
|
||
*.received.* |
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 |
---|---|---|
|
@@ -27,4 +27,4 @@ export default { | |
include: "node_modules/**", | ||
}), | ||
], | ||
}; | ||
}; |
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,6 @@ | ||
import _ from "lodash"; | ||
import Graph from "graphology"; | ||
|
||
export function myFunc(str: string) { | ||
return new Graph(); | ||
} |
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,68 @@ | ||
declare module "approvals" { | ||
export type ApprovalsOptions = any; | ||
|
||
export interface MochaInstance { | ||
verify(data: any, overrideOptions: Partial<ApprovalsOptions>): void; | ||
} | ||
|
||
export function configure(overrideOptions: Partial<ApprovalsOptions>): void; | ||
|
||
export function getConfig( | ||
overrideOptions: Partial<ApprovalsOptions> | ||
): ApprovalsOptions; | ||
|
||
export function verify( | ||
dirName: string, | ||
testName: string, | ||
data: string | Buffer, | ||
optionsOverride: Partial<ApprovalsOptions> | ||
): void; | ||
|
||
export function verifyAndScrub( | ||
dirName: string, | ||
testName: string, | ||
data: string | Buffer, | ||
scrubber: (file: string) => string, | ||
optionsOverride: Partial<ApprovalsOptions> | ||
): void; | ||
|
||
export function verifyAsJSON( | ||
dirName: string, | ||
testName: string, | ||
data: any, | ||
optionsOverride: Partial<ApprovalsOptions> | ||
): void; | ||
|
||
export function verifyAsJSONAndScrub( | ||
dirName: string, | ||
testName: string, | ||
data: any, | ||
scrubber: (file: string) => string, | ||
optionsOverride: Partial<ApprovalsOptions> | ||
): void; | ||
|
||
export function verifyWithControl( | ||
namer: string, | ||
writer: string, | ||
reporterFactory: string, | ||
optionsOverride: Partial<ApprovalsOptions> | ||
): void; | ||
|
||
export const reporters: { | ||
MultiReporter: any; | ||
}; | ||
|
||
export namespace scrubbers { | ||
export function noScrubber(): void; | ||
|
||
export function guidScrubber(): void; | ||
|
||
export function multiScrubber(): void; | ||
} | ||
|
||
/** | ||
* Configure approvals to hook into Mocha tests. | ||
* @param {*} optionalBaseDir - An optional folder to save approval files to. | ||
*/ | ||
export const mocha: (optionalBaseDir?: string) => void; | ||
} |
1 change: 1 addition & 0 deletions
1
test/When_running_some_tests.should_be_able_to_use_Approvals.approved.txt
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 @@ | ||
Hello World! |
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,15 @@ | ||
import { mocha } from "approvals"; | ||
import type { ITestCallbackContext } from "mocha"; | ||
import { getReflexiveClosure } from "../src/sharedFunctions"; | ||
import Graph from "graphology"; | ||
|
||
describe("typescript simple Approvals tests #1.1", () => { | ||
mocha(__dirname); | ||
|
||
it("tutu", function (this: ITestCallbackContext) { | ||
const g = new Graph() | ||
const value = getReflexiveClosure(g, []); | ||
|
||
this.verify(value); | ||
}); | ||
}); |
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,6 @@ | ||
--require ts-node/register | ||
--require source-map-support/register | ||
--recursive | ||
--full-trace | ||
--bail | ||
test/**/*.spec.ts |
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,27 @@ | ||
"use strict"; | ||
import { MultiGraph } from "graphology"; | ||
// import { getReflexiveClosure } from "src/sharedFunctions"; | ||
exports.__esModule = true; | ||
require("approvals").mocha(); | ||
describe("When running some tests", function () { | ||
it("should be able to use Approvals", function () { | ||
var data = "test"; | ||
// const userHiers = [ | ||
// { | ||
// down: ["down"], | ||
// next: ["next"], | ||
// prev: ["prev"], | ||
// same: ["same"], | ||
// up: ["up"], | ||
// }, | ||
// ]; | ||
// const g = new MultiGraph(); | ||
// g.addNode("A"); | ||
// g.addNode("B"); | ||
// g.addNode("C"); | ||
// g.addEdge("A", "B", { dir: "up", field: "parent" }); | ||
// g.addEdge("C", "A", { dir: "prev", field: "previous" }); | ||
// getReflexiveClosure(g, userHiers); | ||
this.verify(data); // or this.verifyAsJSON(data) | ||
}); | ||
}); |
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,33 @@ | ||
// import { MultiGraph } from "graphology"; | ||
// import { getReflexiveClosure } from "src/sharedFunctions"; | ||
|
||
require("approvals").mocha(); | ||
|
||
describe("When running some tests", function () { | ||
it("should be able to use Approvals", function () { | ||
const data = "test"; | ||
// const userHiers = [ | ||
// { | ||
// down: ["down"], | ||
// next: ["next"], | ||
// prev: ["prev"], | ||
// same: ["same"], | ||
// up: ["up"], | ||
// }, | ||
// ]; | ||
|
||
// const g = new MultiGraph(); | ||
// g.addNode("A"); | ||
// g.addNode("B"); | ||
// g.addNode("C"); | ||
|
||
// g.addEdge("A", "B", { dir: "up", field: "parent" }); | ||
// g.addEdge("C", "A", { dir: "prev", field: "previous" }); | ||
|
||
// getReflexiveClosure(g, userHiers); | ||
|
||
this.verify(data); // or this.verifyAsJSON(data) | ||
}); | ||
}); | ||
|
||
export {}; |
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 @@ | ||
TUTU |
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