test.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. const { expect } = require('chai');
  2. const { createModdle } = require('bpmnlint/lib/testers/helper');
  3. const RuleTester = require('bpmnlint/lib/testers/rule-tester');
  4. const manualTaskRule = require('./rules/no-manual-task');
  5. const targetNamespaceRule = require('./rules/target-namespace');
  6. RuleTester.verify('no-manual-task', manualTaskRule, {
  7. valid: [
  8. {
  9. moddleElement: createModdle(
  10. '<startEvent xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="startEvent" />',
  11. 'bpmn:StartEvent'
  12. )
  13. }
  14. ],
  15. invalid: [
  16. {
  17. moddleElement: createModdle(
  18. '<manualTask xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="manualTask" />',
  19. 'bpmn:ManualTask'
  20. ),
  21. report: {
  22. id: 'manualTask',
  23. message: 'Element has disallowed type bpmn:ManualTask'
  24. }
  25. }
  26. ]
  27. });
  28. RuleTester.verify('target-namespace', targetNamespaceRule, {
  29. valid: [
  30. {
  31. moddleElement: createModdle(
  32. '<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="definitions" targetNamespace="http://foo" />',
  33. )
  34. }
  35. ],
  36. invalid: [
  37. {
  38. moddleElement: createModdle(
  39. '<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" id="definitions" />',
  40. ),
  41. report: {
  42. id: 'definitions',
  43. message: 'Element is missing targetNamespace'
  44. }
  45. }
  46. ]
  47. });