Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write Tests for basic models & enums generated output 🧪 #27

Open
YassinEldeeb opened this issue Dec 11, 2021 · 0 comments
Open

Write Tests for basic models & enums generated output 🧪 #27

YassinEldeeb opened this issue Dec 11, 2021 · 0 comments
Labels
enhancement Improving some features or writting tests good first issue Always wanted to get involved in an open source project but don’t know where to begin? Welcome! help wanted Extra attention is needed

Comments

@YassinEldeeb
Copy link
Owner

YassinEldeeb commented Dec 11, 2021

Bug description

Write tests for making sure the models & enums output are generated correctly

Understanding the Feature

  1. specify a sample prisma definitions in the schema.prisma file like the following
generator client {
  provider = "prisma-client-js"
}

generator PrismaTypeGraphQLTypesGenerator {
  provider     = "npx prisma-typegraphql-types-generator"
  modelsOutput = "./src/models"
  enumsOutput  = "./src/types/enums"
  useYarn      = true
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id                            String                 @id @default(cuid())
  name                          String                 @db.VarChar(255)
  // @nullable
  email                         String                 @unique
  // @skip
  password                      String?
  bio                           String?                @db.VarChar(160)
  // @skip
  tokenVersion                  Int                    @default(0)
  // @skip
  confirmed                     Boolean                @default(false)
  profilePic                    String?
  posts                         Post[]
  githubId                      String?                @unique
  lastTimelineVisit             DateTime?
  createdAt                     DateTime               @default(now())
  updatedAt                     DateTime               @updatedAt
}

model Post {
  id             String    @id @default(cuid())
  title          String
  body           String
  tags           String[]
  published      Boolean   @default(false)
  // @skip
  authorId       String
  author         User      @relation(fields: [authorId], references: [id], onDelete: Cascade)
  readingTimeTxt String
  readingTimeMin Float
  coverImg       String?
  createdAt      DateTime  @default(now())
  updatedAt      DateTime  @updatedAt
}

check if It has generated the files and folders based on the specified output location

.
├── ...
├── src
│   ├── models
│            ├── Post.ts
│            └── User.ts
└── ...
@YassinEldeeb YassinEldeeb added the help wanted Extra attention is needed label Dec 11, 2021
@YassinEldeeb YassinEldeeb self-assigned this Dec 11, 2021
@YassinEldeeb YassinEldeeb changed the title Bug: Test basic models & enums generated output 🧪 Write Tests: Test basic models & enums generated output 🧪 Dec 11, 2021
@YassinEldeeb YassinEldeeb changed the title Write Tests: Test basic models & enums generated output 🧪 Write Tests to test basic models & enums generated output 🧪 Dec 11, 2021
@YassinEldeeb YassinEldeeb changed the title Write Tests to test basic models & enums generated output 🧪 Write Tests for basic models & enums generated output 🧪 Dec 11, 2021
@YassinEldeeb YassinEldeeb added good first issue Always wanted to get involved in an open source project but don’t know where to begin? Welcome! enhancement Improving some features or writting tests labels Dec 11, 2021
@YassinEldeeb YassinEldeeb removed their assignment Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving some features or writting tests good first issue Always wanted to get involved in an open source project but don’t know where to begin? Welcome! help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant