Skip to content
This repository was archived by the owner on Aug 15, 2023. It is now read-only.

Commit ccd4236

Browse files
ascariandreavecna
authored andcommitted
chore(tktrex): cli tk test public key
1 parent 3f51971 commit ccd4236

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

platforms/guardoni/scripts/cli-tk-test.mjs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,16 @@ const version = await $`node -p -e "require('./package.json').version"`;
1212
try {
1313
const response = await fetch('http://localhost:14000/api/v0/health');
1414
const isRunning = await response.text();
15-
if(isRunning !== 'OK') {
15+
if (isRunning !== 'OK') {
1616
throw new Error();
1717
}
1818
console.log('\x1b[33mbackend running!\x1b[0m');
1919
} catch (e) {
20-
console.log("backend not running? run:");
20+
console.log('backend not running? run:');
2121
console.log('\x1b[33m$ yarn pm2 start platforms/ecosystem.config.js \x1b[0m');
2222
process.exit(1);
2323
}
2424

25-
2625
const profile = 'profile-test-99';
2726

2827
const cliFlags = [
@@ -42,7 +41,6 @@ const cli = `./dist/guardoni-cli-${version.stdout.replace('\n', '')}-linux`;
4241

4342
// eslint-disable-next-line no-void
4443
void (async function () {
45-
4644
fs.removeSync(path.resolve(process.cwd(), 'profiles', profile));
4745

4846
// register an experiment for search
@@ -51,23 +49,24 @@ void (async function () {
5149
const tk_search_experiment_id =
5250
tk_search_experiment_register_out.stdout.replace('experimentId: \t ', '');
5351

54-
await $`echo ${tk_search_experiment_id}`
52+
await $`echo ${tk_search_experiment_id}`;
5553

5654
// reject cookie modal
57-
await $`${cli} ${cliFlags} tk-navigate --cookie-modal=reject --headless=false`
55+
await $`${cli} ${cliFlags} tk-navigate --cookie-modal=reject --headless=false`;
5856

5957
// # exec the experiment
6058
const tk_search_experiment_run_out =
6159
await $`(${cli} ${experimentCLIFlags} tk-experiment ${tk_search_experiment_id} | grep 'publicKey:')`;
6260

63-
const tk_search_experiment_public_key =
64-
tk_search_experiment_run_out.stdout.replace('publicKey: ', '');
61+
const tk_search_experiment_public_key = tk_search_experiment_run_out.stdout
62+
.replace('publicKey: \t', '')
63+
.replace('\n', '');
6564

6665
await $`echo ${tk_search_experiment_public_key}`;
6766

6867
// check publicKey match when given as env variable
6968

70-
assert.strictEqual(tk_search_experiment_id, process.env.PUBLIC_KEY);
69+
assert.strictEqual(tk_search_experiment_public_key, process.env.PUBLIC_KEY);
7170

7271
await $`curl http://localhost:14000/api/v1/personal/${tk_search_experiment_public_key}/search/json`;
7372

0 commit comments

Comments
 (0)