Necesito Programar Más

    proxy-mocks
    TypeScript icon, indicating that this package has built-in type declarations

    0.1.2 • Public • Published

    proxy-mocks

    Generate mocks for any class or object.

    Example

    // import { IMock, Mock } from 'proxy-mocks/jest';
    import { IMock, Mock } from "proxy-mocks/sinon";
    import Dependency from "./dependency";
    import Implementation from "./implementation";
    
    describe("Implementation", () => {
      let dependency: IMock<Dependency>;
    
      let implementation: Implementation;
    
      beforeEach(() => {
        dependency = Mock.of(Dependency);
    
        implementation = new Implementation(dependency);
      });
    
      test("your test", () => {
        dependency.someMethod.returns("your result");
    
        const result = implementation.anotherMethod();
    
        expect(result).toEqual("your result");
      });
    });

    Keywords

    none

    Install

    npm i proxy-mocks

    DownloadsWeekly Downloads

    64

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    8.75 kB

    Total Files

    10

    Last publish

    Collaborators

    • maxjoehnk