new(all): Unit test infra added again.

This commit is contained in:
Rodrigo Rodriguez 2024-02-17 17:27:53 -03:00
parent e1ec6e0f05
commit 6b4efe3110
6 changed files with 59 additions and 50 deletions

View file

@ -35,7 +35,7 @@
"build-server": "tsc",
"build-gbui": "cd packages/default.gbui && echo SKIP_PREFLIGHT_CHECK=true >.env && npm install && npm run build",
"build-docs": "typedoc --options typedoc.json src/",
"test": "node test.js",
"test": "vitest",
"start": "NODE_NO_WARNINGS=1 node ./boot.mjs --loader ts-node/esm --require ./suppress-node-warnings.cjs",
"debug": "NODE_NO_WARNINGS=1 node ./boot.mjs --loader ts-node/esm --require ./suppress-node-warnings.cjs --inspect",
"reverse-proxy": "node_modules/.bin/ngrok http 4242",
@ -52,6 +52,19 @@
"semantic-release": "semantic-release",
"commit": "git-cz"
},
"jest": {
"workerIdleMemoryLimit": "4096MB",
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json"
]
},
"dependencies": {
"@azure/arm-appservice": "13.0.3",
"@azure/arm-cognitiveservices": "7.3.1",
@ -121,7 +134,7 @@
"google-libphonenumber": "3.2.31",
"googleapis": "126.0.1",
"ibm-watson": "7.1.2",
"iso-639-1": "^3.1.1",
"iso-639-1": "3.1.1",
"join-images-updated": "1.1.4",
"js-md5": "0.8.3",
"just-indent": "0.0.1",
@ -130,6 +143,7 @@
"koa-body": "6.0.1",
"koa-router": "12.0.0",
"langchain": "^0.0.163",
"language-tags": "^1.0.9",
"line-replace": "2.0.1",
"lodash": "4.17.21",
"luxon": "3.1.0",
@ -214,8 +228,8 @@
"super-strong-password-generator": "2.0.2",
"super-strong-password-generator-es": "2.0.2",
"travis-deploy-once": "5.0.11",
"ts-node": "10.9.1",
"tslint": "6.1.3"
"tslint": "6.1.3",
"vitest": "^1.3.0"
},
"eslintConfig": {
"env": {

View file

@ -1155,7 +1155,6 @@ export class GBConversationalService {
let replacements = [];
if (translate) {
// To fix MSFT bug.
if (keepTextList) {
@ -1186,9 +1185,6 @@ export class GBConversationalService {
});
}
GBLog.verbose(`Translated text(sendText): ${text}.`);
}
const analytics = new AnalyticsService();
const conversation = null;
if (!user.conversationId) {

8
src/util.test.ts Normal file
View file

@ -0,0 +1,8 @@
import { GBUtil} from './util';
import { expect, test } from 'vitest'
test('Default', () => {
expect(null).toBe(null);
});

View file

@ -33,17 +33,17 @@
*/
'use strict';
import iso6391 from 'iso-639-1';
import tags from 'language-tags';
export class GBUtil {
public static repeat = function (chr, count) {
public static repeat (chr, count) {
var str = "";
for (var x = 0; x < count; x++) { str += chr };
return str;
}
public static padL = function (value, width, pad) {
public static padL (value, width, pad) {
if (!width || width < 1)
return value;
@ -53,7 +53,7 @@ export class GBUtil {
return (GBUtil.repeat(pad, length) + value).substr(0, width);
}
public static padR = function (value, width, pad) {
public static padR (value, width, pad) {
if (!width || width < 1)
return value;
@ -95,12 +95,4 @@ export class GBUtil {
}
};
public static getLocaleLanguageAndCountry(locale) {
const iso6393Language = iso6391.getCode(locale);
if (iso6393Language) {
return iso6393Language + '-' + locale.toLowerCase();
} else {
return null;
}
}
}

View file

@ -1 +0,0 @@
console.log("Feel free to PR refactored and unit tests added if you want to.");

View file

@ -33,14 +33,14 @@
]
},
"include": [
"test/**/*",
"src/**/*",
"packages/*.gbapp/**/*",
"packages/*.gblib/**/*",
"packages/*.gbtheme/**/*",
"packages/*.gbtheme/**/*"
],
"exclude": [
"dist",
"node_modules"
"node_modules",
"**/*.test.ts"
]
}