-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
76 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,43 @@ | ||
/* | ||
* Copyright 2023 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
import { createVariants } from './CreateVariants.js'; | ||
|
||
const uuid = () => 123; | ||
|
||
describe('createVariants', () => { | ||
test('response is a JSON string: an array of json objects', () => { | ||
const response = [ | ||
{key1: 'value1', key2: 'value2'}, | ||
{key3: 'value3', key4: 'value4'}, | ||
{ key1: 'value1', key2: 'value2' }, | ||
{ key3: 'value3', key4: 'value4' }, | ||
null, | ||
'Hello!', | ||
'<tag>how</tag> is it going?' | ||
'<tag>how</tag> is it going?', | ||
]; | ||
expect(createVariants(uuid, JSON.stringify(response))).toEqual([ | ||
{ id: 123, content: {key1: 'value1', key2: 'value2'} }, | ||
{ id: 123, content: {key3: 'value3', key4: 'value4'} }, | ||
{ id: 123, content: { key1: 'value1', key2: 'value2' } }, | ||
{ id: 123, content: { key3: 'value3', key4: 'value4' } }, | ||
{ id: 123, content: 'null' }, | ||
{ id: 123, content: 'Hello!' }, | ||
{ id: 123, content: 'how is it going?' } | ||
{ id: 123, content: 'how is it going?' }, | ||
]); | ||
}); | ||
test('response is a JSON string: an object', () => { | ||
const response = {key: 'value'}; | ||
const response = { key: 'value' }; | ||
expect(createVariants(uuid, JSON.stringify(response))).toEqual([ | ||
{ id: 123, content: {key: 'value'} }, | ||
{ id: 123, content: { key: 'value' } }, | ||
]); | ||
}); | ||
test('response is a string', () => { | ||
const response = 'Hello! How can I assist you today?'; | ||
expect(createVariants(uuid, response)).toEqual([{ id: 123, content: response }]); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,4 @@ export function toHTML(input) { | |
return `<b>${key}</b>: ${value}`; | ||
}).join('<br/>'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,23 @@ | ||
import { toClipboard, toHTML } from './ExportPrompt.js'; | ||
/* | ||
* Copyright 2023 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
import { toHTML } from './ExportPrompt.js'; | ||
|
||
describe('toHTML', () => { | ||
test('returns html: prompt result is an key/value pair', () => { | ||
const promptResponse = {key1: 'value1', key2: 'value2'}; | ||
const promptResponse = { key1: 'value1', key2: 'value2' }; | ||
expect(toHTML(promptResponse)).toEqual('<b>key1</b>: value1<br/><b>key2</b>: value2'); | ||
}); | ||
test('returns html: prompt result is a string', () => { | ||
const promptResponse = 'hello'; | ||
expect(toHTML(promptResponse)).toEqual('hello'); | ||
}); | ||
}); | ||
|
Oops, something went wrong.