Skip to content

Commit

Permalink
combine test sites (#44)
Browse files Browse the repository at this point in the history
combine test sites

Combines the browser-based test sites for the contained packages
into a single directory, with testing logic for both of the
libraries contained in it. The node-related tests will remain
in chat-core explicitly, as chat-core-aws-connect does not
support Node.
  • Loading branch information
popestr authored Aug 27, 2024
1 parent 21c5218 commit b2d1e1c
Show file tree
Hide file tree
Showing 22 changed files with 4,075 additions and 3,913 deletions.
2,964 changes: 975 additions & 1,989 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions packages/chat-core-aws-connect/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ npm run test
```

### Test Environments
The `chat-core-aws-connect` library is designed to be compatible with both CommonJS and ES6 import styles. Additionally, it should function properly in both browser and Node.js environments. To ensure this, we have set up two distinct test environments:
The `chat-core-aws-connect` library is designed to be compatible with both CommonJS and ES6 import styles. Additionally, it should function properly in browser environments. To ensure this, we have set up a shared testing environment:

- **Browser ESM Test Site:** For more information, refer to the README.md file located in the `/test-browser-esm` directory.

- **Node CJS Test Site:** TODO
- **Browser ESM Test Site:** For more information, refer to the README.md file located in the `test-sites/test-browser-esm` directory.

## Build Process

Expand Down
25 changes: 13 additions & 12 deletions packages/chat-core-aws-connect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

a library used for integrating Yext Chat with the Amazon Connect agent platform.

- Works in both the **browser** and **Node.js**
- 100% **TypeScript**, with detailed request and response models
- Compatible with both **CommonJS** and **ES6** imports
- Currently only supports browser-based chat sessions

## Usage

```typescript
import { provideChatCoreAwsConnect } from "@yext/chat-core-aws-connect";
import { Message, MessageResponse } from "@yext/chat-core";
import { MessageResponse } from "@yext/chat-core";

// create a new instance of ChatCoreAwsConnect
const chatCoreAwsConnect = provideChatCoreAwsConnect();
Expand All @@ -21,17 +20,19 @@ const chatApiResponse: MessageResponse;
// initiate a connection to Amazon Connect using the credentials
await chatCoreAwsConnect.init(chatApiResponse);

// create a message payload
const messages: Message[] = [
{
source: "USER",
text: "Could I get some assistance?",
timestamp: "2023-05-15T17:33:38.373Z",
},
];
// create a payload
const req = {
messages: [
{
timestamp: "2023-05-17T19:21:21.915Z",
source: "USER",
text: "Could I get some assistance?"
},
],
};

// send it to Connect!
await chatCoreAwsConnect.processMessage({ messages });
await chatCoreAwsConnect.processMessage(req);
```

## Documentation
Expand Down
3,065 changes: 2,869 additions & 196 deletions packages/chat-core-aws-connect/THIRD-PARTY-NOTICES

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions packages/chat-core-aws-connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
},
"homepage": "https://github.com/yext/chat-core#readme",
"dependencies": {
"amazon-connect-chatjs": "^2.3.0",
"cross-fetch": "^3.1.5"
"amazon-connect-chatjs": "^2.3.0"
},
"devDependencies": {
"@babel/preset-env": "^7.21.5",
Expand Down
18 changes: 0 additions & 18 deletions packages/chat-core-aws-connect/test-browser-esm/index.html

This file was deleted.

24 changes: 0 additions & 24 deletions packages/chat-core-aws-connect/test-browser-esm/package.json

This file was deleted.

64 changes: 0 additions & 64 deletions packages/chat-core-aws-connect/test-browser-esm/src/script.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/chat-core/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ npm run test
### Test Environments
The `chat-core` library is designed to be compatible with both CommonJS and ES6 import styles. Additionally, it should function properly in both browser and Node.js environments. To ensure this, we have set up two distinct test environments:

- **Browser ESM Test Site:** For more information, refer to the README.md file located in the `/test-browser-esm` directory.
- **Browser ESM Test Site:** For more information, refer to the README.md file located in the `test-sites/test-browser-esm` directory.

- **Node CJS Test Site:** For more details, consult the README.md file found in the `/test-node-cjs` directory.

Expand Down
16 changes: 0 additions & 16 deletions packages/chat-core/test-browser-esm/README.md

This file was deleted.

14 changes: 0 additions & 14 deletions packages/chat-core/test-browser-esm/index.html

This file was deleted.

Loading

0 comments on commit b2d1e1c

Please sign in to comment.