Add basic webtesting example.

Also switch the angular example to use ts_library instead of ts_project.

Change-Id: Ib94c7010bd2af4036d1a04efaf95bbab43cb9ef0
Signed-off-by: Alex Perry <alex.perry96@gmail.com>
diff --git a/build_tests/BUILD b/build_tests/BUILD
index 8dd0637..705c4ff 100644
--- a/build_tests/BUILD
+++ b/build_tests/BUILD
@@ -3,6 +3,8 @@
 load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
 load("//tools/build_rules:apache.bzl", "apache_wrapper")
 load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
+load("@npm//@bazel/typescript:index.bzl", "ts_library")
+load("@npm//@bazel/concatjs:index.bzl", "karma_web_test_suite")
 
 cc_test(
     name = "gflags_build_test",
@@ -155,3 +157,25 @@
     target_compatible_with = ["@platforms//os:linux"],
     deps = [":hello_lib"],
 )
+
+ts_library(
+    name = "build_tests_ts",
+    srcs = ["basic.ts"],
+)
+
+ts_library(
+    name = "ts_test",
+    testonly = True,
+    srcs = ["basic_test.ts"],
+    deps = [
+        ":build_tests_ts",
+        "@npm//@types/jasmine",
+    ],
+)
+
+karma_web_test_suite(
+    name = "karma",
+    testonly = True,
+    target_compatible_with = ["@platforms//os:linux"],
+    deps = [":ts_test"],
+)
diff --git a/build_tests/basic.ts b/build_tests/basic.ts
new file mode 100644
index 0000000..6ddac49
--- /dev/null
+++ b/build_tests/basic.ts
@@ -0,0 +1,6 @@
+/**
+ * Computes the sum of the input values
+ */
+export function add(x: number, y: number): number {
+  return x + y;
+}
diff --git a/build_tests/basic_test.ts b/build_tests/basic_test.ts
new file mode 100644
index 0000000..298f928
--- /dev/null
+++ b/build_tests/basic_test.ts
@@ -0,0 +1,11 @@
+import {add} from './basic';
+
+describe('add', () => {
+  it('should sum numbers', () => {
+    expect(3 + 4).toEqual(7);
+  });
+
+  it('should not sum numbers', () => {
+    expect(add(3, 3)).not.toEqual(7);
+  });
+});