Skip to content

Commit d1e0753

Browse files
committed
Update tests
1 parent 28e76de commit d1e0753

9 files changed

Lines changed: 42 additions & 182 deletions

File tree

__tests__/html2/basic/bundle/es5.html

Lines changed: 0 additions & 60 deletions
This file was deleted.
-8.67 KB
Binary file not shown.

__tests__/html2/basic/bundle/full.html

Lines changed: 0 additions & 60 deletions
This file was deleted.
-8.67 KB
Binary file not shown.

__tests__/html2/basic/bundle/minimal.html

Lines changed: 0 additions & 60 deletions
This file was deleted.
-8.67 KB
Binary file not shown.

__tests__/html2/boot/bundle.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,41 @@
3333

3434
const { WebChat } = window;
3535

36+
const metaMap = new Map(
37+
Array.from(document.querySelectorAll('meta'))
38+
.filter(element => element.name.startsWith('botframework-webchat'))
39+
.map(element => [element.name, element.getAttribute('content')])
40+
);
41+
42+
// THEN: It should have `<meta name="botframework-webchat:api">`.
43+
expect(metaMap.has('botframework-webchat:api')).toBe(true);
44+
expect(metaMap.get('botframework-webchat:api')).toEqual(expect.stringContaining('build-tool=tsup'));
45+
expect(metaMap.get('botframework-webchat:api')).toEqual(expect.stringContaining('module-format='));
46+
expect(metaMap.get('botframework-webchat:api')).toEqual(expect.stringContaining('version='));
47+
expect(metaMap.has('botframework-webchat:api:version')).toBe(true);
48+
49+
// THEN: It should have `<meta name="botframework-webchat">`.
50+
expect(metaMap.has('botframework-webchat')).toBe(true);
51+
expect(metaMap.get('botframework-webchat')).toEqual(expect.stringContaining('build-tool=tsup'));
52+
expect(metaMap.get('botframework-webchat')).toEqual(expect.stringContaining('module-format=global'));
53+
expect(metaMap.get('botframework-webchat')).toEqual(expect.stringContaining(`variant=${variant}`));
54+
expect(metaMap.get('botframework-webchat')).toEqual(expect.stringContaining('version='));
55+
expect(metaMap.has('botframework-webchat:version')).toBe(true);
56+
57+
// THEN: It should have `<meta name="botframework-webchat:component">`.
58+
expect(metaMap.has('botframework-webchat:component')).toBe(true);
59+
expect(metaMap.get('botframework-webchat:component')).toEqual(expect.stringContaining('build-tool=tsup'));
60+
expect(metaMap.get('botframework-webchat:component')).toEqual(expect.stringContaining('module-format='));
61+
expect(metaMap.get('botframework-webchat:component')).toEqual(expect.stringContaining('version='));
62+
expect(metaMap.has('botframework-webchat:component:version')).toBe(true);
63+
64+
// THEN: It should have `<meta name="botframework-webchat:core">`.
65+
expect(metaMap.has('botframework-webchat:core')).toBe(true);
66+
expect(metaMap.get('botframework-webchat:core')).toEqual(expect.stringContaining('build-tool=tsup'));
67+
expect(metaMap.get('botframework-webchat:core')).toEqual(expect.stringContaining('module-format='));
68+
expect(metaMap.get('botframework-webchat:core')).toEqual(expect.stringContaining('version='));
69+
expect(metaMap.has('botframework-webchat:core:version')).toBe(true);
70+
3671
// THEN: `window.WebChat` should be a plain object.
3772
expect(typeof WebChat).toBe('object');
3873

@@ -71,6 +106,9 @@
71106
expect(WebChat.Components.AdaptiveCardContent).toBeUndefined();
72107
}
73108

109+
// THEN: `buildInfo.buildTool` should be "tsup".
110+
expect(WebChat).toHaveProperty('buildInfo.buildTool', 'tsup');
111+
74112
// THEN: `buildInfo.moduleFromat` should be "global".
75113
expect(WebChat).toHaveProperty('buildInfo.moduleFormat', 'global'); // Bundle
76114

packages/base/src/utils/createBuildInfo.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ class BuildInfo implements ReadonlyBuildInfo {
4040

4141
#commit() {
4242
setMetaTag(this.name, this.#map);
43+
44+
this.version && setMetaTag(`${this.name}:version`, this.version);
4345
}
4446

4547
delete(key: string) {
@@ -64,7 +66,7 @@ class BuildInfo implements ReadonlyBuildInfo {
6466
}
6567
}
6668

67-
function createBuildInfo(name: `botframework-webchat:${string}`): ReadonlyBuildInfo {
69+
function createBuildInfo(name: 'botframework-webchat' | `botframework-webchat:${string}`): ReadonlyBuildInfo {
6870
return new BuildInfo(name);
6971
}
7072

packages/bundle/src/buildInfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createBuildInfo } from '@msinternal/botframework-webchat-base/utils';
22

3-
const buildInfo = createBuildInfo('botframework-webchat:bundle');
3+
const buildInfo = createBuildInfo('botframework-webchat');
44

55
buildInfo.set('buildTool', WEB_CHAT_BUILD_INFO_BUILD_TOOL);
66
buildInfo.set('moduleFormat', WEB_CHAT_BUILD_INFO_MODULE_FORMAT);

0 commit comments

Comments
 (0)