52 lines
2.7 KiB
TypeScript
52 lines
2.7 KiB
TypeScript
|
|
import assert from 'assert/strict';
|
||
|
|
import { readFileSync } from 'fs';
|
||
|
|
import { dirname, resolve } from 'path';
|
||
|
|
import { fileURLToPath } from 'url';
|
||
|
|
|
||
|
|
const root = resolve(dirname(fileURLToPath(import.meta.url)), '../../..');
|
||
|
|
|
||
|
|
const readWorkspaceFile = (pathFromRoot: string) => {
|
||
|
|
return readFileSync(resolve(root, pathFromRoot), 'utf8');
|
||
|
|
};
|
||
|
|
|
||
|
|
const assertIncludes = (filePath: string, expected: string) => {
|
||
|
|
const content = readWorkspaceFile(filePath);
|
||
|
|
assert.ok(content.includes(expected), `${filePath} should include ${expected}`);
|
||
|
|
};
|
||
|
|
|
||
|
|
const assertExcludes = (filePath: string, forbidden: string) => {
|
||
|
|
const content = readWorkspaceFile(filePath);
|
||
|
|
assert.ok(!content.includes(forbidden), `${filePath} should not include ${forbidden}`);
|
||
|
|
};
|
||
|
|
|
||
|
|
assertIncludes('containerarchive/rust/src/prune.rs', 'rewritten_offsets');
|
||
|
|
assertExcludes('containerarchive/rust/src/prune.rs', 'offset: entry.offset, // Note: offset in the new pack may differ');
|
||
|
|
assertIncludes('containerarchive/test/test.ts', 'partial-pack GC rewrites chunks');
|
||
|
|
|
||
|
|
assertExcludes('onebox/ts/classes/onebox.ts', "hashPassword('admin')");
|
||
|
|
assertIncludes('onebox/ts/classes/onebox.ts', 'ONEBOX_ADMIN_PASSWORD');
|
||
|
|
assertExcludes('dcrouter/ts/opsserver/handlers/admin.handler.ts', "password: 'admin'");
|
||
|
|
assertIncludes('dcrouter/ts/opsserver/handlers/admin.handler.ts', 'DCROUTER_ADMIN_PASSWORD');
|
||
|
|
assertExcludes('corerender/ts/rendertron.db.ts', 'wxW4LBa3sxPjyXGf');
|
||
|
|
assertExcludes('corerender/ts/rendertron.db.ts', 'losslessone-main.zee8suk.mongodb.net');
|
||
|
|
|
||
|
|
assertIncludes('api/ts/classes.cloudlyapiclient.ts', 'return response;');
|
||
|
|
assertIncludes('api/ts/classes.image.ts', 'versionString: imageVersion');
|
||
|
|
assertIncludes('cloudly/ts/manager.image/classes.imagemanager.ts', 'readFromWebstream(readable)');
|
||
|
|
assertIncludes('cloudly/ts/manager.service/classes.servicemanager.ts', 'adminIdentityGuard');
|
||
|
|
assertIncludes('cloudly/ts/manager.cluster/classes.clustermanager.ts', 'getClusterById');
|
||
|
|
|
||
|
|
assertIncludes('platformclient/ts/email/classes.emailconnector.ts', 'return response.responseId');
|
||
|
|
assertIncludes('platformclient/ts/email/classes.letterconnector.ts', 'return response.processId');
|
||
|
|
assertIncludes('platformclient/ts/email/classes.pushnotificationconnector.ts', "typeof process !== 'undefined'");
|
||
|
|
|
||
|
|
assertIncludes('siprouter/ts/sipproxy.ts', 'return { id: callId };');
|
||
|
|
assertIncludes('onebox/ts/opsserver/classes.opsserver.ts', "'/v2/*'");
|
||
|
|
assertIncludes('spark/ts/spark.cli.ts', 'CLOUDLY_URL: cloudlyUrl');
|
||
|
|
|
||
|
|
const rustdeskConfig = JSON.parse(readWorkspaceFile('appstore-apptemplates/apps/rustdesk-server/versions/1.0.0/config.json'));
|
||
|
|
const relay = rustdeskConfig.envVars.find((entry: { key: string }) => entry.key === 'RELAY');
|
||
|
|
assert.equal(relay?.value, '${SERVICE_DOMAIN}:21116');
|
||
|
|
|
||
|
|
console.log('codebase regression checks passed');
|