-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { describe, expect, it } from "vitest"; | ||
import { Post, PostArgs } from "./post.js"; | ||
import { Snowflake } from "../helpers/id_generator.js"; | ||
import { Media } from "./media.js"; | ||
|
||
describe("Post", () => { | ||
const defaultPostArgs: PostArgs = { | ||
id: "10101450391945216" as Snowflake, | ||
authorID: "10101451896913920" as Snowflake, | ||
text: "Hello, world!", | ||
visibility: 0, | ||
createdAt: new Date(), | ||
attachments: [], | ||
reactions: [], | ||
}; | ||
|
||
it("添付ファイルは16個以上添付できない", () => { | ||
expect(() => { | ||
new Post({ | ||
...defaultPostArgs, | ||
attachments: new Array(17).fill({} as Media), | ||
}); | ||
}).toThrowError( | ||
new Error( | ||
"failed to create post: The number of attachments must be less than 16.", | ||
), | ||
); | ||
}); | ||
|
||
it("ファイルを添付できる", () => { | ||
expect(() => { | ||
new Post({ | ||
...defaultPostArgs, | ||
attachments: new Array(10).fill({} as Media), | ||
}); | ||
}).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters