mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-20 06:51:48 -05:00
assorted ui_next search phase 1 pr feedback updates
- remove unnecessary displayAll prop from ChipGroup - update notification api fn to be 2 with no boolean param - fix params passing to api functions
This commit is contained in:
@@ -8,23 +8,36 @@ export function describeNotificationMixin (Model, name) {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
const parameters = [
|
||||
['success', true],
|
||||
['success', false],
|
||||
['error', true],
|
||||
['error', false],
|
||||
];
|
||||
parameters.forEach(([type, state]) => {
|
||||
const label = `[notificationType=${type}, associationState=${state}]`;
|
||||
const testName = `updateNotificationTemplateAssociation ${label} makes expected http calls`;
|
||||
const parameters = ['success', 'error'];
|
||||
|
||||
parameters.forEach((type) => {
|
||||
const label = `[notificationType=${type}, associationState=true`;
|
||||
const testName = `associateNotificationTemplate ${label} makes expected http calls`;
|
||||
|
||||
test(testName, async (done) => {
|
||||
await ModelAPI.updateNotificationTemplateAssociation(1, 21, type, state);
|
||||
await ModelAPI.associateNotificationTemplate(1, 21, type);
|
||||
|
||||
const expectedPath = `${ModelAPI.baseUrl}1/notification_templates_${type}/`;
|
||||
expect(mockHttp.post).toHaveBeenCalledTimes(1);
|
||||
|
||||
const expectedParams = state ? { id: 21 } : { id: 21, disassociate: true };
|
||||
const expectedParams = { id: 21 };
|
||||
expect(mockHttp.post.mock.calls.pop()).toEqual([expectedPath, expectedParams]);
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
parameters.forEach((type) => {
|
||||
const label = `[notificationType=${type}, associationState=false`;
|
||||
const testName = `disassociateNotificationTemplate ${label} makes expected http calls`;
|
||||
|
||||
test(testName, async (done) => {
|
||||
await ModelAPI.disassociateNotificationTemplate(1, 21, type);
|
||||
|
||||
const expectedPath = `${ModelAPI.baseUrl}1/notification_templates_${type}/`;
|
||||
expect(mockHttp.post).toHaveBeenCalledTimes(1);
|
||||
|
||||
const expectedParams = { id: 21, disassociate: true };
|
||||
expect(mockHttp.post.mock.calls.pop()).toEqual([expectedPath, expectedParams]);
|
||||
|
||||
done();
|
||||
|
||||
Reference in New Issue
Block a user