resistor-color-trio.test.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { decodedResistorValue } from './resistor-color-trio'
  2. xit = it
  3. describe('Resistor Colors', () => {
  4. it('Orange and orange and black', () => {
  5. expect(decodedResistorValue(['orange', 'orange', 'black'])).toEqual(
  6. '33 ohms'
  7. )
  8. })
  9. xit('Blue and grey and brown', () => {
  10. expect(decodedResistorValue(['blue', 'grey', 'brown'])).toEqual('680 ohms')
  11. })
  12. xit('Red and black and red', () => {
  13. expect(decodedResistorValue(['red', 'black', 'red'])).toEqual('2 kiloohms')
  14. })
  15. xit('Green and brown and orange', () => {
  16. expect(decodedResistorValue(['green', 'brown', 'orange'])).toEqual(
  17. '51 kiloohms'
  18. )
  19. })
  20. xit('Yellow and violet and yellow', () => {
  21. expect(decodedResistorValue(['yellow', 'violet', 'yellow'])).toEqual(
  22. '470 kiloohms'
  23. )
  24. })
  25. xit('Blue and violet and blue', () => {
  26. expect(decodedResistorValue(['blue', 'violet', 'blue'])).toEqual(
  27. '67 megaohms'
  28. )
  29. })
  30. xit('Minimum possible value', () => {
  31. expect(decodedResistorValue(['black', 'black', 'black'])).toEqual('0 ohms')
  32. })
  33. xit('Maximum possible value', () => {
  34. expect(decodedResistorValue(['white', 'white', 'white'])).toEqual(
  35. '99 gigaohms'
  36. )
  37. })
  38. xit('First two colors make an invalid octal number', () => {
  39. expect(decodedResistorValue(['black', 'grey', 'black'])).toEqual('8 ohms')
  40. })
  41. xit('Ignore extra colors', () => {
  42. expect(decodedResistorValue(['blue', 'green', 'yellow', 'orange'])).toEqual(
  43. '650 kiloohms'
  44. )
  45. })
  46. })