passbolt-styleguide
Version:
Passbolt styleguide contains common styling assets used by the different sites, plugin, etc.
68 lines (59 loc) • 2.28 kB
JavaScript
/**
* Passbolt ~ Open source password manager for teams
* Copyright (c) Passbolt SA (https://www.passbolt.com)
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://www.passbolt.com Passbolt(tm)
* @since 5.8.0
*/
/**
* Unit tests on DeleteRoleNotAllowed in regard of specifications
*/
import { defaultProps } from "./DeleteRoleNotAllowed.test.data";
import DeleteRoleNotAllowedPage from "./DeleteRoleNotAllowed.test.page";
beforeEach(() => {
jest.resetModules();
});
describe("Delete role not allowed", () => {
let page; // The page to test against
let props = null; // The page props
beforeEach(() => {
props = defaultProps(); // The props to pass
page = new DeleteRoleNotAllowedPage(props);
});
describe("As AD I should delete a role", () => {
it("As AD I should submit an delete request with nothing updated", async () => {
expect.assertions(1);
await page.submit();
expect(props.onClose).toHaveBeenCalledTimes(1);
});
});
describe("AS AD I should cancel the operation", () => {
it("AS AD I should cancel the operation by closing the dialog", async () => {
expect.assertions(1);
await page.close();
expect(props.onClose).toHaveBeenCalledTimes(1);
});
it("AS AD I should cancel the operation by explicitly cancelling", async () => {
expect.assertions(1);
await page.cancel();
expect(props.onClose).toHaveBeenCalledTimes(1);
});
});
describe("AS AD I should not perform actions during the role deletion not allowed", () => {
it("AS AD I should not cancel, submit or change data during the role deletion not allowed", async () => {
expect.assertions(3);
const inProgressFn = () => {
expect(page.canCancel).toBeFalsy();
expect(page.canClose).toBeFalsy();
expect(page.canSubmit).toBeFalsy();
};
await page.submit(inProgressFn);
});
});
});