Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
unit(validator): correct the inputs
Browse files Browse the repository at this point in the history
Co-authored-by: Kenneth Trecy Tobias <19201.tobias.kennethtrecy.c@gmail.com>
  • Loading branch information
lemredd and KennethTrecy committed Nov 6, 2022
1 parent 014d003 commit 8a7ae75
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions server/validators/manager/has_no_other_posts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@ import validator from "./has_no_other_posts"

describe("Validator: has no other posts", () => {
it("can accept valid input", async() => {
const postFactory = new PostFactory()
const postTagFactory = new PostTagFactory()
const post = await postFactory.insertOne()
await new PostFactory().insertOne()
const model = await new Factory().insertOne()
await postTagFactory
.post(() => Promise.resolve(post))
.tag(() => Promise.resolve(model))
.insertOne()
const value = Promise.resolve(makeInitialState(model.id))
const constraints = {
"field": "hello",
Expand All @@ -33,8 +27,14 @@ describe("Validator: has no other posts", () => {
})

it("cannot accept invalid value", async() => {
await new PostFactory().insertOne()
const postFactory = new PostFactory()
const postTagFactory = new PostTagFactory()
const post = await postFactory.insertOne()
const model = await new Factory().insertOne()
await postTagFactory
.post(() => Promise.resolve(post))
.tag(() => Promise.resolve(model))
.insertOne()
const value = Promise.resolve(makeInitialState(model.id))
const constraints = {
"field": "hello",
Expand Down

0 comments on commit 8a7ae75

Please sign in to comment.