mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Merge pull request #1243 from hgiesel/actualtest
Add minimal tests to html-filter
This commit is contained in:
commit
42c71cd204
3 changed files with 12 additions and 4 deletions
|
@ -5,17 +5,18 @@ load("//ts:eslint.bzl", "eslint_test")
|
||||||
|
|
||||||
ts_library(
|
ts_library(
|
||||||
name = "html-filter",
|
name = "html-filter",
|
||||||
module_name = "html-filter",
|
|
||||||
srcs = glob(
|
srcs = glob(
|
||||||
["*.ts"],
|
["*.ts"],
|
||||||
exclude = ["*.test.ts"],
|
exclude = ["*.test.ts"],
|
||||||
),
|
),
|
||||||
|
module_name = "html-filter",
|
||||||
tsconfig = "//ts:tsconfig.json",
|
tsconfig = "//ts:tsconfig.json",
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
deps = [],
|
deps = [],
|
||||||
)
|
)
|
||||||
|
|
||||||
jest_test(
|
jest_test(
|
||||||
|
env = "jsdom",
|
||||||
deps = [
|
deps = [
|
||||||
"html-filter",
|
"html-filter",
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
test("it should work", () => {
|
import { filterHTML } from ".";
|
||||||
expect("test").toBe("test");
|
|
||||||
|
describe("filterHTML", () => {
|
||||||
|
test("zero input creates zero output", () => {
|
||||||
|
expect(filterHTML("", true, false)).toBe("");
|
||||||
|
expect(filterHTML("", true, false)).toBe("");
|
||||||
|
expect(filterHTML("", false, false)).toBe("");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@ load("@npm//@bazel/typescript:index.bzl", "ts_library")
|
||||||
load("@esbuild_toolchain//:esbuild.bzl", esbuild = "esbuild_macro")
|
load("@esbuild_toolchain//:esbuild.bzl", esbuild = "esbuild_macro")
|
||||||
load("@npm//jest-cli:index.bzl", _jest_test = "jest_test")
|
load("@npm//jest-cli:index.bzl", _jest_test = "jest_test")
|
||||||
|
|
||||||
def jest_test(deps, name = "jest", protobuf = False):
|
def jest_test(deps, name = "jest", protobuf = False, env = "node"):
|
||||||
"Build *.test.ts into a library, then test it with Jest."
|
"Build *.test.ts into a library, then test it with Jest."
|
||||||
|
|
||||||
ts_sources = native.glob(["*.test.ts"])
|
ts_sources = native.glob(["*.test.ts"])
|
||||||
|
@ -61,6 +61,7 @@ def jest_test(deps, name = "jest", protobuf = False):
|
||||||
"--colors",
|
"--colors",
|
||||||
"--config",
|
"--config",
|
||||||
"$(location //ts:jest.config.js)",
|
"$(location //ts:jest.config.js)",
|
||||||
|
"--env=" + env,
|
||||||
],
|
],
|
||||||
data = bundled_srcs + [
|
data = bundled_srcs + [
|
||||||
"//ts:jest.config.js",
|
"//ts:jest.config.js",
|
||||||
|
|
Loading…
Reference in a new issue