|
33 | 33 |
|
34 | 34 | const { WebChat } = window; |
35 | 35 |
|
| 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 | + |
36 | 71 | // THEN: `window.WebChat` should be a plain object. |
37 | 72 | expect(typeof WebChat).toBe('object'); |
38 | 73 |
|
|
71 | 106 | expect(WebChat.Components.AdaptiveCardContent).toBeUndefined(); |
72 | 107 | } |
73 | 108 |
|
| 109 | + // THEN: `buildInfo.buildTool` should be "tsup". |
| 110 | + expect(WebChat).toHaveProperty('buildInfo.buildTool', 'tsup'); |
| 111 | + |
74 | 112 | // THEN: `buildInfo.moduleFromat` should be "global". |
75 | 113 | expect(WebChat).toHaveProperty('buildInfo.moduleFormat', 'global'); // Bundle |
76 | 114 |
|
|
0 commit comments