-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from Barqawiz/test-scripts
Test scripts, security fixes and release version
- Loading branch information
Showing
26 changed files
with
258 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ | |
node_modules | ||
.idea | ||
dist | ||
test/ | ||
test/integration/ |
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
4 changes: 2 additions & 2 deletions
4
IntelliNode/test/AzureOpenAIWrapper.test.js → ...st/integration/AzureOpenAIWrapper.test.js
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
4 changes: 2 additions & 2 deletions
4
IntelliNode/test/Chatbot.test.js → IntelliNode/test/integration/Chatbot.test.js
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
2 changes: 1 addition & 1 deletion
2
IntelliNode/test/CohereAIWrapper.test.js → .../test/integration/CohereAIWrapper.test.js
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
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
IntelliNode/test/Gen.test.js → IntelliNode/test/integration/Gen.test.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
IntelliNode/test/GoogleAIWrapper.test.js → .../test/integration/GoogleAIWrapper.test.js
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
2 changes: 1 addition & 1 deletion
2
IntelliNode/test/HuggingWrapper.test.js → ...e/test/integration/HuggingWrapper.test.js
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
2 changes: 1 addition & 1 deletion
2
IntelliNode/test/LanguageModelInput.test.js → ...st/integration/LanguageModelInput.test.js
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
4 changes: 2 additions & 2 deletions
4
IntelliNode/test/OpenAIWrapper.test.js → ...de/test/integration/OpenAIWrapper.test.js
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
4 changes: 2 additions & 2 deletions
4
IntelliNode/test/RemoteEmbedModel.test.js → ...test/integration/RemoteEmbedModel.test.js
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
4 changes: 2 additions & 2 deletions
4
IntelliNode/test/RemoteImageModel.test.js → ...test/integration/RemoteImageModel.test.js
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
4 changes: 2 additions & 2 deletions
4
IntelliNode/test/RemoteLanguageModel.test.js → ...t/integration/RemoteLanguageModel.test.js
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
4 changes: 2 additions & 2 deletions
4
IntelliNode/test/SemanticSearch.test.js → ...e/test/integration/SemanticSearch.test.js
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
4 changes: 2 additions & 2 deletions
4
IntelliNode/test/StabilityAIWrapper.test.js → ...st/integration/StabilityAIWrapper.test.js
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
4 changes: 2 additions & 2 deletions
4
IntelliNode/test/TextAnalyzer.test.js → ...ode/test/integration/TextAnalyzer.test.js
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
const assert = require('assert'); | ||
const CohereAIWrapper = require('../../wrappers/CohereAIWrapper'); | ||
const config = require('../../utils/Config2').getInstance(); | ||
|
||
function testCohereAIWrapper() { | ||
const apiKey = 'your-api-key'; | ||
const cohereAIWrapper = new CohereAIWrapper(apiKey); | ||
|
||
assert.strictEqual(cohereAIWrapper.API_KEY, apiKey, 'API key should be set'); | ||
assert.ok(cohereAIWrapper.httpClient, 'httpClient should be created'); | ||
|
||
// Test httpClient configuration | ||
const expectedBaseURL = config.getProperty('url.cohere.base'); | ||
const expectedCohereVersion = config.getProperty('url.cohere.version'); | ||
const expectedContentType = 'application/json'; | ||
const expectedAuthHeader = `Bearer ${apiKey}`; | ||
|
||
assert.strictEqual( | ||
cohereAIWrapper.httpClient.defaults.baseURL, | ||
expectedBaseURL, | ||
'httpClient baseURL should be set correctly' | ||
); | ||
assert.strictEqual( | ||
cohereAIWrapper.httpClient.defaults.headers['Content-Type'], | ||
expectedContentType, | ||
'httpClient Content-Type header should be set correctly' | ||
); | ||
assert.strictEqual( | ||
cohereAIWrapper.httpClient.defaults.headers['Authorization'], | ||
expectedAuthHeader, | ||
'httpClient Authorization header should be set correctly' | ||
); | ||
assert.strictEqual( | ||
cohereAIWrapper.httpClient.defaults.headers['Cohere-Version'], | ||
expectedCohereVersion, | ||
'httpClient Cohere-Version header should be set correctly' | ||
); | ||
} | ||
|
||
module.exports = testCohereAIWrapper; |
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const assert = require('assert'); | ||
const GoogleAIWrapper = require('../../wrappers/GoogleAIWrapper'); | ||
const config = require('../../utils/Config2').getInstance(); | ||
|
||
function testGoogleAIWrapper() { | ||
const apiKey = 'your-api-key'; | ||
const googleAIWrapper = new GoogleAIWrapper(apiKey); | ||
|
||
assert.strictEqual(googleAIWrapper.API_KEY, apiKey, 'API key should be set'); | ||
assert.ok(googleAIWrapper.httpClient, 'httpClient should be created'); | ||
|
||
// Test httpClient configuration | ||
const expectedBaseURL = config | ||
.getProperty('url.google.base') | ||
.replace('{1}', config.getProperty('url.google.speech.prefix')); | ||
const expectedContentType = 'application/json; charset=utf-8'; | ||
|
||
assert.strictEqual( | ||
googleAIWrapper.httpClient.defaults.baseURL, | ||
expectedBaseURL, | ||
'httpClient baseURL should be set correctly' | ||
); | ||
assert.strictEqual( | ||
googleAIWrapper.httpClient.defaults.headers['Content-Type'], | ||
expectedContentType, | ||
'httpClient Content-Type header should be set correctly' | ||
); | ||
assert.strictEqual( | ||
googleAIWrapper.httpClient.defaults.headers['X-Goog-Api-Key'], | ||
apiKey, | ||
'httpClient X-Goog-Api-Key header should be set correctly' | ||
); | ||
|
||
// Test getSynthesizeInput() method | ||
const params = { | ||
text: 'Hello world', | ||
languageCode: 'en-US', | ||
name: 'en-US-Wavenet-A', | ||
ssmlGender: 'MALE', | ||
}; | ||
const expectedModelInput = JSON.stringify({ | ||
input: { | ||
text: params.text, | ||
}, | ||
voice: { | ||
languageCode: params.languageCode, | ||
name: params.name, | ||
ssmlGender: params.ssmlGender, | ||
}, | ||
audioConfig: { | ||
audioEncoding: 'MP3', | ||
}, | ||
}); | ||
|
||
assert.strictEqual( | ||
googleAIWrapper.getSynthesizeInput(params), | ||
expectedModelInput, | ||
'getSynthesizeInput() should return the correct model input as a JSON string' | ||
); | ||
} | ||
|
||
module.exports = testGoogleAIWrapper; |
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const assert = require('assert'); | ||
const HuggingWrapper = require('../../wrappers/HuggingWrapper'); | ||
const config = require('../../utils/Config2').getInstance(); | ||
|
||
function testHuggingWrapper() { | ||
const apiKey = 'your-api-key'; | ||
const huggingWrapper = new HuggingWrapper(apiKey); | ||
|
||
assert.strictEqual(huggingWrapper.API_KEY, apiKey, 'API key should be set'); | ||
assert.ok(huggingWrapper.httpClient, 'httpClient should be created'); | ||
|
||
// Test httpClient configuration | ||
const expectedBaseURL = config.getProperty('url.huggingface.base'); | ||
const expectedContentType = 'application/json'; | ||
const expectedAuthHeader = `Bearer ${apiKey}`; | ||
|
||
assert.strictEqual( | ||
huggingWrapper.httpClient.defaults.baseURL, | ||
expectedBaseURL, | ||
'httpClient baseURL should be set correctly' | ||
); | ||
assert.strictEqual( | ||
huggingWrapper.httpClient.defaults.headers['Content-Type'], | ||
expectedContentType, | ||
'httpClient Content-Type header should be set correctly' | ||
); | ||
assert.strictEqual( | ||
huggingWrapper.httpClient.defaults.headers['Authorization'], | ||
expectedAuthHeader, | ||
'httpClient Authorization header should be set correctly' | ||
); | ||
} | ||
|
||
module.exports = testHuggingWrapper; |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const assert = require('assert'); | ||
const OpenAIWrapper = require('../../wrappers/OpenAIWrapper'); | ||
const ProxyHelper = require('../../utils/ProxyHelper'); | ||
const config = require('../../utils/Config2').getInstance(); | ||
|
||
function testOpenAIWrapper() { | ||
const apiKey = 'your-api-key'; | ||
const proxyHelper = ProxyHelper.getInstance(); | ||
const openAIWrapper = new OpenAIWrapper(apiKey); | ||
|
||
assert.strictEqual(openAIWrapper.API_KEY, apiKey, 'API key should be set'); | ||
assert.ok(openAIWrapper.httpClient, 'httpClient should be created'); | ||
|
||
// Test httpClient configuration | ||
const expectedBaseURL = proxyHelper.getOpenaiURL(); | ||
const expectedContentType = 'application/json'; | ||
const expectedAuthHeader = `Bearer ${apiKey}`; | ||
|
||
assert.strictEqual( | ||
openAIWrapper.httpClient.defaults.baseURL, | ||
expectedBaseURL, | ||
'httpClient baseURL should be set correctly' | ||
); | ||
assert.strictEqual( | ||
openAIWrapper.httpClient.defaults.headers['Content-Type'], | ||
expectedContentType, | ||
'httpClient Content-Type header should be set correctly' | ||
); | ||
assert.strictEqual( | ||
openAIWrapper.httpClient.defaults.headers['Authorization'], | ||
expectedAuthHeader, | ||
'httpClient Authorization header should be set correctly' | ||
); | ||
} | ||
|
||
module.exports = testOpenAIWrapper; |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const assert = require('assert'); | ||
const StabilityAIWrapper = require('../../wrappers/StabilityAIWrapper'); | ||
const config = require('../../utils/Config2').getInstance(); | ||
|
||
function testStabilityAIWrapper() { | ||
const apiKey = 'your-api-key'; | ||
const stabilityAIWrapper = new StabilityAIWrapper(apiKey); | ||
|
||
assert.strictEqual(stabilityAIWrapper.API_KEY, apiKey, 'API key should be set'); | ||
assert.ok(stabilityAIWrapper.httpClient, 'httpClient should be created'); | ||
|
||
// Test httpClient configuration | ||
const expectedBaseURL = config.getProperty('url.stability.base'); | ||
const expectedAuthHeader = `Bearer ${apiKey}`; | ||
|
||
assert.strictEqual( | ||
stabilityAIWrapper.httpClient.defaults.baseURL, | ||
expectedBaseURL, | ||
'httpClient baseURL should be set correctly' | ||
); | ||
assert.strictEqual( | ||
stabilityAIWrapper.httpClient.defaults.headers['Authorization'], | ||
expectedAuthHeader, | ||
'httpClient Authorization header should be set correctly' | ||
); | ||
} | ||
|
||
module.exports = testStabilityAIWrapper; |
Oops, something went wrong.