pw_web: Add basic bundling tests for log viewer bundle
Change-Id: I17e9d1b28f8cc2662a61a01ab459da23d7a71dc9
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/168539
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Asad Memon <asadmemon@google.com>
diff --git a/ts/index_test.ts b/ts/index_test.ts
index 2299e69..bca65db 100644
--- a/ts/index_test.ts
+++ b/ts/index_test.ts
@@ -26,6 +26,11 @@
} from '../dist/index.umd';
import { ProtoCollection } from '../dist/protos/collection.umd';
+import {
+ createLogViewer,
+ MockLogSource,
+ PigweedRPCLogSource,
+} from '../dist/logging.umd';
import * as fs from 'fs';
describe('Pigweed Bundle', () => {
@@ -66,6 +71,19 @@
expect(WebSerial.WebSerialTransport).toBeDefined();
});
+ it('has log viewer exports defined', () => {
+ expect(createLogViewer).toBeDefined();
+ expect(typeof createLogViewer).toBe('function');
+
+ expect(MockLogSource).toBeDefined();
+ expect(typeof MockLogSource).toBe('function');
+ expect(MockLogSource.name).toBe('MockLogSource');
+
+ expect(PigweedRPCLogSource).toBeDefined();
+ expect(typeof PigweedRPCLogSource).toBe('function');
+ expect(PigweedRPCLogSource.name).toBe('PigweedRPCLogSource');
+ });
+
it('is not referring to any outside Pigweed modules', () => {
const requireString = "require('pigweedjs";
const file = fs.readFileSync(require.resolve('../dist/index.umd'));