mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
120 lines
4.0 KiB
TypeScript
120 lines
4.0 KiB
TypeScript
import nock from "nock";
|
|
|
|
nock("https://cloud.appwrite.io:443", { encodedQueryParams: true })
|
|
.post("/v1/databases/default/collections/blog_posts/documents", {
|
|
documentId: "unique()",
|
|
data: { title: "Lorem Ipsum 1" },
|
|
permissions: ['read("any")', 'write("any")'],
|
|
})
|
|
.reply(
|
|
201,
|
|
{
|
|
title: "Lorem Ipsum 1",
|
|
$id: "669e6aedd28ee989d36a",
|
|
$permissions: ['read("any")', 'update("any")', 'delete("any")'],
|
|
$createdAt: "2024-07-22T14:21:33.864+00:00",
|
|
$updatedAt: "2024-07-22T14:21:33.864+00:00",
|
|
$tenant: "169888",
|
|
status: "published",
|
|
content: null,
|
|
images: null,
|
|
$databaseId: "default",
|
|
$collectionId: "blog_posts",
|
|
},
|
|
[
|
|
"Access-Control-Allow-Credentials",
|
|
"true",
|
|
"Access-Control-Allow-Headers",
|
|
"Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Forwarded-For, X-Forwarded-User-Agent",
|
|
"Access-Control-Allow-Methods",
|
|
"GET, POST, PUT, PATCH, DELETE",
|
|
"Access-Control-Allow-Origin",
|
|
"https://localhost",
|
|
"Access-Control-Expose-Headers",
|
|
"X-Appwrite-Session, X-Fallback-Cookies",
|
|
"Content-Length",
|
|
"335",
|
|
"Content-Type",
|
|
"application/json; charset=UTF-8",
|
|
"Date",
|
|
"Mon, 22 Jul 2024 14:21:33 GMT",
|
|
"Server",
|
|
"Appwrite",
|
|
"Strict-Transport-Security",
|
|
"max-age=10886400",
|
|
"X-Content-Type-Options",
|
|
"nosniff",
|
|
"X-Debug-Fallback",
|
|
"true",
|
|
"X-Debug-Speed",
|
|
"0.066951036453247",
|
|
"X-Ratelimit-Limit",
|
|
"120",
|
|
"X-Ratelimit-Remaining",
|
|
"119",
|
|
"X-Ratelimit-Reset",
|
|
"1721658120",
|
|
"Connection",
|
|
"close",
|
|
],
|
|
);
|
|
|
|
nock("https://cloud.appwrite.io:443", { encodedQueryParams: true })
|
|
.post("/v1/databases/default/collections/blog_posts/documents", {
|
|
documentId: "unique()",
|
|
data: { title: "Lorem Ipsum 2" },
|
|
permissions: ['read("any")', 'write("any")'],
|
|
})
|
|
.reply(
|
|
201,
|
|
{
|
|
title: "Lorem Ipsum 2",
|
|
$id: "669e6aede00a831a58c3",
|
|
$permissions: ['read("any")', 'update("any")', 'delete("any")'],
|
|
$createdAt: "2024-07-22T14:21:33.918+00:00",
|
|
$updatedAt: "2024-07-22T14:21:33.918+00:00",
|
|
$tenant: "169888",
|
|
status: "published",
|
|
content: null,
|
|
images: null,
|
|
$databaseId: "default",
|
|
$collectionId: "blog_posts",
|
|
},
|
|
[
|
|
"Access-Control-Allow-Credentials",
|
|
"true",
|
|
"Access-Control-Allow-Headers",
|
|
"Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma, X-Forwarded-For, X-Forwarded-User-Agent",
|
|
"Access-Control-Allow-Methods",
|
|
"GET, POST, PUT, PATCH, DELETE",
|
|
"Access-Control-Allow-Origin",
|
|
"https://localhost",
|
|
"Access-Control-Expose-Headers",
|
|
"X-Appwrite-Session, X-Fallback-Cookies",
|
|
"Content-Length",
|
|
"335",
|
|
"Content-Type",
|
|
"application/json; charset=UTF-8",
|
|
"Date",
|
|
"Mon, 22 Jul 2024 14:21:33 GMT",
|
|
"Server",
|
|
"Appwrite",
|
|
"Strict-Transport-Security",
|
|
"max-age=10886400",
|
|
"X-Content-Type-Options",
|
|
"nosniff",
|
|
"X-Debug-Fallback",
|
|
"true",
|
|
"X-Debug-Speed",
|
|
"0.063269853591919",
|
|
"X-Ratelimit-Limit",
|
|
"120",
|
|
"X-Ratelimit-Remaining",
|
|
"118",
|
|
"X-Ratelimit-Reset",
|
|
"1721658120",
|
|
"Connection",
|
|
"close",
|
|
],
|
|
);
|