You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

method.spec.ts 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /// <reference path='typings/globals.d.ts' />
  2. import method from '../src/method'
  3. import { Client } from '../src/client'
  4. import { MockClient } from './mocks/client'
  5. const mockMethodSpec = {}
  6. describe('Method', () => {
  7. let mockClient: Client
  8. let methodGenerator
  9. let methodFunction
  10. before(() => {
  11. mockClient = new MockClient()
  12. })
  13. it('accepts client and returns generator function', () => {
  14. methodGenerator = method(mockClient)
  15. expect(true).to.deep.equal(true)
  16. // expect(methodFunction).to.be.a.function() // TODO:
  17. })
  18. it('accepts a method specification and returns a method function', () =>{
  19. methodFunction = methodGenerator(mockMethodSpec)
  20. // expect(methodFunction).to.be.a.function() // TODO:
  21. })
  22. describe('Method function', () => {
  23. it('calls underlying request on client', () => {
  24. methodFunction()
  25. // expect(someSpy).to.be.called.once.with.exaclty() // TODO:
  26. })
  27. it('requires path parameters if specified', () => {
  28. // methodFunction = undefined
  29. // methodFunction() // should throw
  30. })
  31. it('passes path parameters if specified', () => {
  32. // methodFunction = undefined
  33. // methodFunction(1) // should not throw
  34. })
  35. it('requires body arguments if specified', () => {
  36. // methodFunction = undefined
  37. // methodFunction() // should throw
  38. })
  39. it('passes body arguments if specified', () => {
  40. // methodFunction = undefined
  41. // methodFunction({ some: 'payload' })
  42. })
  43. })
  44. })