Advertisement
ErolKZ

Untitled

Feb 10th, 2022
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1.  
  2. describe('rgb to hex', () => {
  3.  
  4. it('Should take three integer numbers', () => {
  5.  
  6. let returnValue = rgbToHexColor(22, 12, 3);
  7.  
  8. expect(returnValue).to.be.an('string');
  9.  
  10. });
  11.  
  12.  
  13. it('Should return undefined', () => {
  14.  
  15. let returnValue = rgbToHexColor('22', 12, 3);
  16.  
  17. expect(returnValue).to.be.undefined;
  18.  
  19. });
  20.  
  21.  
  22. it('Should return undefined one', () => {
  23.  
  24. let returnValue = rgbToHexColor();
  25.  
  26. expect(returnValue).to.be.undefined;
  27.  
  28. });
  29.  
  30.  
  31. it('Should return undefined two', () => {
  32.  
  33. let returnValue = rgbToHexColor(12, 22);
  34.  
  35. expect(returnValue).to.be.undefined;
  36.  
  37. });
  38.  
  39.  
  40. it('Should return undefined three', () => {
  41.  
  42. let returnValue = rgbToHexColor('sasdasd');
  43.  
  44. expect(returnValue).to.be.undefined;
  45.  
  46. });
  47.  
  48.  
  49. it('Should return undefined four', () => {
  50.  
  51. let returnValue = rgbToHexColor(-2, 22, 12);
  52.  
  53. expect(returnValue).to.be.undefined;
  54.  
  55. });
  56.  
  57.  
  58. it('Should return undefined five', () => {
  59.  
  60. let returnValue = rgbToHexColor(342, 22, 12);
  61.  
  62. expect(returnValue).to.be.undefined;
  63.  
  64. });
  65.  
  66.  
  67. it('Should be in hexadecimal format', () => {
  68.  
  69. let returnValue = rgbToHexColor(32, 22, 12);
  70.  
  71. expect(/^#[0-9A-F]{6}$/i.test(returnValue)).to.be.true;
  72.  
  73. });
  74.  
  75.  
  76.  
  77.  
  78. });
  79.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement