-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(test): Add unit test for user activity custom property
Partly implements #154
- Loading branch information
1 parent
bbfc410
commit 3131917
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
src/__tests__/activity_custom_property_create_cert.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { jest, test, expect, describe } from '@jest/globals'; | ||
|
||
import { createUserActivityBucketsCustomProperty } from '../lib/cmd/qseow/createuseractivitycp.js'; | ||
|
||
const options = { | ||
logLevel: process.env.CTRL_Q_LOG_LEVEL || 'info', | ||
authType: process.env.CTRL_Q_AUTH_TYPE || 'cert', | ||
authCertFile: process.env.CTRL_Q_AUTH_CERT_FILE || './cert/client.pem', | ||
authCertKeyFile: process.env.CTRL_Q_AUTH_CERT_KEY_FILE || './cert/client_key.pem', | ||
authRootCertFile: process.env.CTRL_Q_AUTH_ROOT_CERT_FILE || './cert/root.pem', | ||
host: process.env.CTRL_Q_HOST || '', | ||
port: process.env.CTRL_Q_PORT || '4242', | ||
schemaVersion: process.env.CTRL_Q_SCHEMA_VERSION || '12.612.0', | ||
virtualProxy: process.env.CTRL_Q_VIRTUAL_PROXY || '', | ||
secure: process.env.CTRL_Q_SECURE || true, | ||
authUserDir: process.env.CTRL_Q_AUTH_USER_DIR || '', | ||
authUserId: process.env.CTRL_Q_AUTH_USER_ID || '', | ||
|
||
updateUserSleep: process.env.CTRL_Q_UPDATE_USER_SLEEP || 500, | ||
updateBatchSleep: process.env.CTRL_Q_UPDATE_BATCH_SLEEP || 3, | ||
updateBatchSize: process.env.CTRL_Q_UPDATE_BATCH_SIZE || 10, | ||
updateBatchSize: process.env.CTRL_Q_UPDATE_BATCH_SIZE || 10, | ||
activityBuckets: process.env.CTRL_Q_ACTIVITY_BUCKETS || ['1', '7', '14', '30', '90', '180', '365'], | ||
licenseType: process.env.CTRL_Q_LICENSE_TYPE || ['analyzer', 'analyzer-time', 'login', 'professional', 'user'], | ||
}; | ||
|
||
const defaultTestTimeout = process.env.CTRL_Q_TEST_TIMEOUT || 600000; // 10 minute default timeout | ||
console.log(`Jest timeout: ${defaultTestTimeout}`); | ||
jest.setTimeout(defaultTestTimeout); | ||
|
||
test('get tasks (verify parameters) ', async () => { | ||
expect(options.authCertFile).not.toHaveLength(0); | ||
expect(options.authCertKeyFile).not.toHaveLength(0); | ||
expect(options.authRootCertFile).not.toHaveLength(0); | ||
expect(options.host).not.toHaveLength(0); | ||
expect(options.authUserDir).not.toHaveLength(0); | ||
expect(options.authUserId).not.toHaveLength(0); | ||
}); | ||
|
||
// Test suite for creating user activity buckets custom property | ||
describe('create user activity custom property (cert auth)', () => { | ||
test('do not overwrite existing custom property, default buckets, user directory [LAB]', async () => { | ||
options.userDirectory = ['LAB']; | ||
options.customPropertyName = 'Ctrl_Q_User_Activity_Bucket'; | ||
options.force = true; | ||
|
||
const result = await createUserActivityBucketsCustomProperty(options); | ||
expect(result).toBe(true); | ||
}); | ||
}); |