mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
26 lines
824 B
TypeScript
26 lines
824 B
TypeScript
import { getRefineEvent } from "../../src/utils";
|
|
|
|
describe("getRefineEvent", () => {
|
|
it("should return 'created' when the event includes '.create'", () => {
|
|
const event = "user.create";
|
|
const expected = "created";
|
|
expect(getRefineEvent(event)).toBe(expected);
|
|
});
|
|
|
|
it("should return 'undefined' when the event includes '.update'", () => {
|
|
const event = "user.update";
|
|
expect(getRefineEvent(event)).toBeUndefined();
|
|
});
|
|
|
|
it("should return 'deleted' when the event includes '.delete'", () => {
|
|
const event = "user.delete";
|
|
const expected = "deleted";
|
|
expect(getRefineEvent(event)).toBe(expected);
|
|
});
|
|
|
|
it("should return 'undefined' when the event does not match any pattern", () => {
|
|
const event = "user.unknown";
|
|
expect(getRefineEvent(event)).toBeUndefined();
|
|
});
|
|
});
|