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

Commit

Permalink
unit(query): pretend the inputs are correct
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Sep 15, 2022
1 parent a9021e2 commit 245f6e4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions database/queries/chat_message/sift_by_kinds.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { Message } from "$/types/message"

import Model from "%/models/chat_message"
import Factory from "~/factories/chat_message"

import siftByKind from "./sift_by_kind"
import siftByKind from "./sift_by_kinds"

describe("Database Pipe: Sift by kind", () => {
describe("Database Pipe: Sift by kinds", () => {
it("can find all models", async() => {
const model = await new Factory().insertOne()

Expand All @@ -23,7 +25,7 @@ describe("Database Pipe: Sift by kind", () => {

const options = siftByKind({}, {
"filter": {
"chatMessageKinds": [ model.kind ]
"chatMessageKinds": [ model.kind ] as Message["kind"][]
}
})
const foundModels = await Model.findAll(options)
Expand All @@ -39,7 +41,7 @@ describe("Database Pipe: Sift by kind", () => {
const options = siftByKind({}, {
"filter": {
// Repeat the kind name so there will be no match
"chatMessageKinds": [ model.kind + model.kind ]
"chatMessageKinds": [ model.kind + model.kind ] as Message["kind"][]
}
})
const foundModels = await Model.findAll(options)
Expand Down
2 changes: 1 addition & 1 deletion shareable/types/query.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Message } from "$/types/message"
import type { Serializable } from "$/types/general"
import type { UserKind, Day } from "$/types/database"
import type { Message } from "$/types/message"

export interface ExistenceFilter extends Serializable {
filter: {
Expand Down

0 comments on commit 245f6e4

Please sign in to comment.