mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 03:48:25 -04:00
remove jest
This commit is contained in:
committed by
Alex Janousek
parent
76edf0796b
commit
a65dbb6550
@@ -1,52 +0,0 @@
|
|||||||
describe("Organization Dashboard - initEditServiceConfirmation", () => {
|
|
||||||
let confirmButton, editForm;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
document.body.innerHTML = `
|
|
||||||
<form id="edit-service-form" action="/submit" method="post">
|
|
||||||
<input type="text" id="service_name" name="service_name" value="Test Service" />
|
|
||||||
<input type="email" id="primary_contact" name="primary_contact" value="test@example.com" />
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class="usa-modal" id="confirmEditModal">
|
|
||||||
<button type="button" id="edit-service-confirm-btn" class="usa-button">Confirm changes</button>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
confirmButton = document.getElementById('edit-service-confirm-btn');
|
|
||||||
editForm = document.getElementById('edit-service-form');
|
|
||||||
|
|
||||||
editForm.submit = jest.fn();
|
|
||||||
|
|
||||||
require('../../app/assets/javascripts/organizationDashboard.js');
|
|
||||||
document.dispatchEvent(new Event('DOMContentLoaded'));
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
document.body.innerHTML = "";
|
|
||||||
jest.resetModules();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Clicking confirm button submits the edit form", () => {
|
|
||||||
confirmButton.click();
|
|
||||||
|
|
||||||
expect(editForm.submit).toHaveBeenCalledTimes(1);
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Does nothing if confirm button doesn't exist", () => {
|
|
||||||
confirmButton.remove();
|
|
||||||
|
|
||||||
expect(() => {
|
|
||||||
const btn = document.getElementById('edit-service-confirm-btn');
|
|
||||||
if (btn) btn.click();
|
|
||||||
}).not.toThrow();
|
|
||||||
});
|
|
||||||
|
|
||||||
test("Does nothing if edit form doesn't exist", () => {
|
|
||||||
editForm.remove();
|
|
||||||
|
|
||||||
confirmButton.click();
|
|
||||||
|
|
||||||
expect(true).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user