first commit
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
# Packaged
|
||||
|
||||
The tests in this file are run on the packaged code that is published to npm. The packaged code is different from the source code in atleast the following ways
|
||||
|
||||
- Not all files go to packaged code.If package.json -> files field is specified then only the files that are specified there would be published. So, one might accidentally miss an important file that's available otherwise.
|
||||
- The packaged code doesn't have .ts files. Those files are actually converted to .js files and .d.ts files are generated separately for TypeScript support. It allows the package to work in both TypeScript and non TypeScript environments.
|
||||
25
calcom/packages/embeds/embed-react/test/packaged/api.test.ts
Normal file
25
calcom/packages/embeds/embed-react/test/packaged/api.test.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* @fileoverview
|
||||
* This file tests two things in 2 ways
|
||||
* - It is a vitest test file and thus it tests if the code executes without any error. Thus, it tests that package.json->main/module fields are correctly defined. It obviously verifies the assertions as well.
|
||||
* - It is also validates for it's types and thus verifies that @calcom/embed-react has correctly specified it's types in package.json->types field.
|
||||
*/
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
// This import may show up as an error in your IDE, but it's fine because typings are available only after embed-react is built.
|
||||
import { getCalApi } from "@calcom/embed-react";
|
||||
|
||||
const api = getCalApi();
|
||||
|
||||
test("Check that the API is available", async () => {
|
||||
expect(api).toBeDefined();
|
||||
const awaitedApi = await api;
|
||||
awaitedApi("floatingButton", {
|
||||
calLink: "free",
|
||||
config: {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-expect-error We are intentionaly testing invalid value
|
||||
layout: "wrongview",
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"extends": "@calcom/tsconfig/base.json",
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"target": "ES2015",
|
||||
"moduleResolution": "Node",
|
||||
"baseUrl": ".",
|
||||
"declaration": true,
|
||||
"jsx": "preserve",
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user