Skip to content
File

Blob: src/workerd/api/api-rtti-test.c++

1.6 KB
1// Copyright (c) 2017-2022 Cloudflare, Inc.
2// Licensed under the Apache 2.0 license found in the LICENSE file or at:
3// https://opensource.org/licenses/Apache-2.0
4 
5#include <workerd/api/actor-state.h>
6#include <workerd/api/actor.h>
7#include <workerd/api/cache.h>
8#include <workerd/api/crypto/crypto.h>
9#include <workerd/api/encoding.h>
10#include <workerd/api/events.h>
11#include <workerd/api/eventsource.h>
12#include <workerd/api/global-scope.h>
13#include <workerd/api/html-rewriter.h>
14#include <workerd/api/queue.h>
15#include <workerd/api/scheduled.h>
16#include <workerd/api/sockets.h>
17#include <workerd/api/sql.h>
18#include <workerd/api/streams.h>
19#include <workerd/api/streams/standard.h>
20#include <workerd/api/sync-kv.h>
21#include <workerd/api/trace.h>
22#include <workerd/api/url-standard.h>
23#include <workerd/api/urlpattern-standard.h>
24#include <workerd/api/urlpattern.h>
25#include <workerd/io/compatibility-date.h>
26#include <workerd/jsg/rtti.h>
27 
28#include <kj/test.h>
29 
30// Test building rtti for various APIs.
31 
32namespace workerd::api {
33namespace {
34 
35KJ_TEST("WorkerGlobalScope") {
36 jsg::rtti::Builder builder((CompatibilityFlags::Reader()));
37 builder.structure<WorkerGlobalScope>();
38 KJ_EXPECT(builder.structure("workerd::api::Event"_kj) != kj::none);
39 KJ_EXPECT(builder.structure("workerd::api::ObviouslyWrongName"_kj) == kj::none);
40}
41 
42KJ_TEST("ServiceWorkerGlobalScope") {
43 jsg::rtti::Builder builder((CompatibilityFlags::Reader()));
44 builder.structure<ServiceWorkerGlobalScope>();
45 KJ_EXPECT(builder.structure("workerd::api::DurableObjectId"_kj) != kj::none);
46}
47 
48} // namespace
49} // namespace workerd::api