Skip to content

Commit

Permalink
fix: tests pass with optional args
Browse files Browse the repository at this point in the history
  • Loading branch information
BelfordZ committed Jun 13, 2019
1 parent 9c250b6 commit b523020
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const testOpenRPCDocument = {
params: [
{
name: "jibberNiptip",
required: true,
schema: {
description: "a really cool niptip",
title: "niptip",
Expand All @@ -22,6 +23,7 @@ const testOpenRPCDocument = {
],
result: {
name: "jibberRipslip",
required: true,
schema: {
properties: {
reepadoop: { type: "number" },
Expand Down Expand Up @@ -334,14 +336,9 @@ describe("MethodTypings", () => {
{
name: "jobber",
params: [
{
name: "ripper",
schema: {
type: "string",
},
},
{
name: "ripslip",
required: true,
schema: {
anyOf: [
{
Expand All @@ -362,6 +359,7 @@ describe("MethodTypings", () => {
},
{
name: "biperbopper",
required: true,
schema: {
oneOf: [
{
Expand All @@ -381,6 +379,7 @@ describe("MethodTypings", () => {
},
{
name: "slippyslopper",
required: true,
schema: {
allOf: [
{
Expand All @@ -401,6 +400,12 @@ describe("MethodTypings", () => {
],
},
},
{
name: "ripper",
schema: {
type: "string",
},
},
],
result: {
name: "froppledocks",
Expand All @@ -416,8 +421,7 @@ describe("MethodTypings", () => {
const methodTypings = new MethodTypings(doc);
await methodTypings.generateTypings();
expect(methodTypings.toString("typescript"))
.toBe(`export type StringWxzVcTo3 = string;
/**
.toBe(`/**
* its a b.
*/
export type Bee = number;
Expand All @@ -444,6 +448,7 @@ export interface WithFoo {
[k: string]: any;
}
export type AllOfHguKC4QU = WithBaz & WithBar & WithFoo;
export type Jobber = (ripper: StringWxzVcTo3, ripslip: AnyOfBWswD897, biperbopper: OneOfDgZSW92J, slippyslopper: AllOfHguKC4QU) => Promise<StringWxzVcTo3>;`); //tslint:disable-line
export type StringWxzVcTo3 = string;
export type Jobber = (ripslip: AnyOfBWswD897, biperbopper: OneOfDgZSW92J, slippyslopper: AllOfHguKC4QU, ripper?: StringWxzVcTo3) => Promise<StringWxzVcTo3>;`); //tslint:disable-line
});
});

0 comments on commit b523020

Please sign in to comment.