Random case vaultId
This commit is contained in:
parent
a86a056888
commit
ff02fee6a5
5 changed files with 49 additions and 24 deletions
3
frontend/test-client/jest.config.js
Normal file
3
frontend/test-client/jest.config.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module.exports = {
|
||||
preset: "ts-jest/presets/js-with-babel-esm"
|
||||
};
|
||||
|
|
@ -1,24 +1,24 @@
|
|||
{
|
||||
"name": "test-client",
|
||||
"version": "0.3.8",
|
||||
"private": true,
|
||||
"bin": {
|
||||
"test-client": "./dist/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "webpack watch --mode development",
|
||||
"build": "webpack --mode production",
|
||||
"test": "jest --passWithNoTests"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.14.0",
|
||||
"sync-client": "file:../sync-client",
|
||||
"ts-loader": "^9.5.2",
|
||||
"tslib": "2.8.1",
|
||||
"typescript": "5.8.2",
|
||||
"uuid": "^11.1.0",
|
||||
"webpack": "^5.98.0",
|
||||
"webpack-cli": "^6.0.1",
|
||||
"bufferutil": "^4.0.9"
|
||||
}
|
||||
"name": "test-client",
|
||||
"version": "0.3.8",
|
||||
"private": true,
|
||||
"bin": {
|
||||
"test-client": "./dist/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "webpack watch --mode development",
|
||||
"build": "webpack --mode production",
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.14.0",
|
||||
"sync-client": "file:../sync-client",
|
||||
"ts-loader": "^9.5.2",
|
||||
"tslib": "2.8.1",
|
||||
"typescript": "5.8.2",
|
||||
"uuid": "^11.1.0",
|
||||
"webpack": "^5.98.0",
|
||||
"webpack-cli": "^6.0.1",
|
||||
"bufferutil": "^4.0.9"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import type { SyncSettings } from "sync-client";
|
|||
import { MockAgent } from "./agent/mock-agent";
|
||||
import { sleep } from "./utils/sleep";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { randomCasing } from "./utils/random-casing";
|
||||
|
||||
let slowFileEvents = false;
|
||||
|
||||
|
|
@ -29,8 +30,8 @@ async function runTest({
|
|||
console.info(`Using vault name: ${vaultName}`);
|
||||
const initialSettings: Partial<SyncSettings> = {
|
||||
isSyncEnabled: true,
|
||||
token: "test-token-change-me", // same as in backend/config-e2e.yml
|
||||
vaultName,
|
||||
token: " test-token-change-me ", // same as in backend/config-e2e.yml with spaces
|
||||
vaultName: randomCasing(vaultName) + (Math.random() > 0.5 ? " " : ""), // extra spaces shouldn't matter
|
||||
syncConcurrency: concurrency,
|
||||
remoteUri: "http://localhost:3000"
|
||||
};
|
||||
|
|
|
|||
11
frontend/test-client/src/utils/random-casing.test.ts
Normal file
11
frontend/test-client/src/utils/random-casing.test.ts
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { randomCasing } from "./random-casing";
|
||||
|
||||
describe("randomCasing", () => {
|
||||
it("simple test", () => {
|
||||
const input =
|
||||
"hello, this is a really long string with a lot of characters";
|
||||
const result = randomCasing(input);
|
||||
expect(result.toLowerCase()).toBe(input.toLowerCase());
|
||||
expect(result).not.toBe(input);
|
||||
});
|
||||
});
|
||||
10
frontend/test-client/src/utils/random-casing.ts
Normal file
10
frontend/test-client/src/utils/random-casing.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export function randomCasing(str: string): string {
|
||||
const chars = str.split("");
|
||||
const randomCasedChars = chars.map((char) => {
|
||||
if (Math.random() < 0.5) {
|
||||
return char.toUpperCase();
|
||||
}
|
||||
return char.toLowerCase();
|
||||
});
|
||||
return randomCasedChars.join("");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue