Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/modules / ___dist / _forks / graphene / test / interface.js
Size: Mime:
"use strict";

var _graphql = require("graphql");

var _src = require("../src");

describe("Interface", () => {
  test(`create Interface`, () => {
    class MyInterface extends _src.Interface {}

    expect(MyInterface.typeName).toBe("MyInterface");
    expect(MyInterface.description).toBe(undefined);
  });
  test(`create Interface custom settings`, () => {
    class MyInterface extends _src.Interface {}

    Object.defineProperty(MyInterface, "typeName", {
      configurable: true,
      enumerable: true,
      writable: true,
      value: "MyInterfaceType"
    });
    Object.defineProperty(MyInterface, "description", {
      configurable: true,
      enumerable: true,
      writable: true,
      value: "MyInterfaceType Description"
    });
    expect(MyInterface.typeName).toBe("MyInterfaceType");
    expect(MyInterface.description).toBe("MyInterfaceType Description");
  });
  test(`create Interface with fields`, () => {
    class MyInterface extends _src.Interface {}

    Object.defineProperty(MyInterface, "description", {
      configurable: true,
      enumerable: true,
      writable: true,
      value: "My Description"
    });
    Object.defineProperty(MyInterface, "fields", {
      configurable: true,
      enumerable: true,
      writable: true,
      value: {
        hello: new _src.Field(_src.String)
      }
    });
    expect(Object.keys(MyInterface.fields)).toEqual(["hello"]);
    const gql = MyInterface.gql;
    expect(gql).toBeInstanceOf(_graphql.GraphQLInterfaceType);
    expect(gql.name).toBe("MyInterface");
    expect(gql.description).toBe("My Description");
    expect(Object.keys(gql.getFields())).toEqual(["hello"]);
  });
});