Skip to content

Commit

Permalink
fix(unit-test): Tests for setting task custom properties now work as …
Browse files Browse the repository at this point in the history
…intended
  • Loading branch information
mountaindude committed Nov 4, 2024
1 parent 99362ba commit 779ee4e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
16 changes: 11 additions & 5 deletions src/__tests__/task_custom_property_set_cert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ describe('set custom property on reload task (cert auth)', () => {

// Get task and verify that CPs have been set
const task = await getTaskById(existingTaskId, options);
expect(task.customProperties.length).toBe(2);

// Find how many values the ctrl_q_unit_test_1 CP has
const cp = task.customProperties.filter((item) => item.definition.name === options.customPropertyName);
expect(cp.length).toBe(2);

// Verify that CP has the correct values
expect(task.customProperties[0].value).toBe('Value 1');
expect(task.customProperties[1].value).toBe('Value 2');
expect(cp[0].value).toBe('Value 1');
expect(cp[1].value).toBe('Value 2');
});

/**
Expand All @@ -90,9 +93,12 @@ describe('set custom property on reload task (cert auth)', () => {

// Get task and verify that CPs have been set
const task = await getTaskById(existingTaskId, options);
expect(task.customProperties.length).toBe(3);

// Find how many values the ctrl_q_unit_test_1 CP has
const cp = task.customProperties.filter((item) => item.definition.name === options.customPropertyName);
expect(cp.length).toBe(3);

// Verify that CP has the correct values
expect(task.customProperties[2].value).toBe('Value 3');
expect(cp[2].value).toBe('Value 3');
});
});
16 changes: 11 additions & 5 deletions src/__tests__/task_custom_property_set_jwt.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ describe('set custom property on reload task (jwt auth)', () => {

// Get task and verify that CPs have been set
const task = await getTaskById(existingTaskId, options);
expect(task.customProperties.length).toBe(2);

// Find how many values the ctrl_q_unit_test_1 CP has
const cp = task.customProperties.filter((item) => item.definition.name === options.customPropertyName);
expect(cp.length).toBe(2);

// Verify that CP has the correct values
expect(task.customProperties[0].value).toBe('Value 1');
expect(task.customProperties[1].value).toBe('Value 2');
expect(cp[0].value).toBe('Value 1');
expect(cp[1].value).toBe('Value 2');
});

/**
Expand All @@ -86,9 +89,12 @@ describe('set custom property on reload task (jwt auth)', () => {

// Get task and verify that CPs have been set
const task = await getTaskById(existingTaskId, options);
expect(task.customProperties.length).toBe(3);

// Find how many values the ctrl_q_unit_test_1 CP has
const cp = task.customProperties.filter((item) => item.definition.name === options.customPropertyName);
expect(cp.length).toBe(3);

// Verify that CP has the correct values
expect(task.customProperties[2].value).toBe('Value 3');
expect(cp[2].value).toBe('Value 3');
});
});

0 comments on commit 779ee4e

Please sign in to comment.