Skip to content

Commit

Permalink
Add stripe test (ScalablyTyped#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
steinybot committed Aug 7, 2024
1 parent 02257bf commit 2c267a2
Show file tree
Hide file tree
Showing 15 changed files with 165 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ trait ImporterTest extends AnyFunSuite with ImporterHarness with ParallelTestExe
test("recharts")(assertImportsOk("recharts", pedantic = true))
test("firebase")(assertImportsOk("firebase", pedantic = true))
test("prisma")(assertImportsOk("prisma", pedantic = true))
test("stripe")(assertImportsOk("stripe", pedantic = true))

test("material-ui-slinky")(
assertImportsOk("material-ui", pedantic = true, flavour = Slinky),
Expand Down
10 changes: 10 additions & 0 deletions tests/stripe/check-3/s/stripe-js/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
organization := "org.scalablytyped"
name := "stripe-js"
version := "4.1.0-084381"
scalaVersion := "3.3.1"
enablePlugins(ScalaJSPlugin)
libraryDependencies ++= Seq(
"com.olvind" %%% "scalablytyped-runtime" % "2.4.2")
publishArtifact in packageDoc := false
scalacOptions ++= List("-encoding", "utf-8", "-feature", "-language:implicitConversions", "-language:higherKinds", "-language:existentials", "-no-indent", "-source:future")
licenses += ("MIT", url("http://opensource.org/licenses/MIT"))
1 change: 1 addition & 0 deletions tests/stripe/check-3/s/stripe-js/project/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sbt.version=1.9.6
1 change: 1 addition & 0 deletions tests/stripe/check-3/s/stripe-js/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("org.scala-js" %% "sbt-scalajs" % "1.11.0")
16 changes: 16 additions & 0 deletions tests/stripe/check-3/s/stripe-js/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

# Scala.js typings for stripe-js

Typings are for version 4.1.0



## Note
This library has been generated from typescript code from first party type definitions.

Provided with :purple_heart: from [ScalablyTyped](https://github.com/oyvindberg/ScalablyTyped)

## Usage
See [the main readme](../../readme.md) for instructions.


Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"compile-dependencies" : [
{
"stripe-js" : "4.1.0"
}
],
"test-dependencies" : [
{
"stripe-js" : "4.1.0"
}
],
"compile-devDependencies" : [
],
"test-devDependencies" : [
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package typings.stripeJs

import org.scalablytyped.runtime.StObject
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSGlobalScope, JSGlobal, JSImport, JSName, JSBracketAccess}

/* This can be used to `require` the library as a side effect.
If it is a global library this will make scalajs-bundler include it */
@JSImport("stripe-js", JSImport.Namespace)
@js.native
object stripeJsRequire extends StObject
4 changes: 4 additions & 0 deletions tests/stripe/in/stdlib.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// <reference no-default-lib="true"/>

declare interface Promise<T> {}
interface Array<T> {}
11 changes: 11 additions & 0 deletions tests/stripe/in/stripe-js/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {StripeConstructor} from './stripe-js';

export {loadStripe} from './shared';

declare global {
interface Window {
// Stripe.js must be loaded directly from https://js.stripe.com/v3, which
// places a `Stripe` object on the window
Stripe?: StripeConstructor;
}
}
5 changes: 5 additions & 0 deletions tests/stripe/in/stripe-js/dist/pure.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {loadStripe as _loadStripe} from './shared';

export const loadStripe: typeof _loadStripe & {
setLoadParameters: (params: {advancedFraudSignals: boolean}) => void;
};
6 changes: 6 additions & 0 deletions tests/stripe/in/stripe-js/dist/shared.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {StripeConstructorOptions, Stripe} from './stripe-js';

export const loadStripe: (
publishableKey: string,
options?: StripeConstructorOptions | undefined
) => Promise<Stripe | null>;
1 change: 1 addition & 0 deletions tests/stripe/in/stripe-js/dist/stripe-js/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './stripe';
49 changes: 49 additions & 0 deletions tests/stripe/in/stripe-js/dist/stripe-js/stripe.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
export interface Stripe {
foo(): void
}

export interface StripeConstructor {
(
/**
* Your publishable key.
*/
publishableKey: string,

/**
* Initialization options.
*/
options?: StripeConstructorOptions
): Stripe;
}

export interface StripeConstructorOptions {
/**
* For usage with [Connect](https://stripe.com/docs/connect) only.
* Specifying a connected account ID (e.g., `acct_24BFMpJ1svR5A89k`) allows you to perform actions on behalf of that account.
*/
stripeAccount?: string;

/**
* Override your account's [API version](https://stripe.com/docs/api/versioning).
*/
apiVersion?: string;

/**
* The [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) used to globally configure localization in Stripe.js.
* Setting the locale here will localize error strings for all Stripe.js methods.
* It will also configure the locale for [Elements](#element_mount) and [Checkout](https://stripe.com/docs/js/checkout/redirect_to_checkout). Default is `auto` (Stripe detects the locale of the browser).
*
* Supported values depend on which features you are using.
* Checkout supports a slightly different set of locales than the rest of Stripe.js.
* If you are planning on using Checkout, make sure to use a [value](#checkout_redirect_to_checkout-options-locale) that it supports.
*/
locale?: string;

/**
* Opt-in to prerelease Stripe.js features by passing `betas` when instantiating a `Stripe` object.
*
* Supported values for the `betas` option can be found in integration guides for prerelease features.
* Most users of Stripe.js do not pass this option.
*/
betas?: string[];
}
14 changes: 14 additions & 0 deletions tests/stripe/in/stripe-js/lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//export * from '../dist';

// import {loadStripe} from '../dist';
// export {loadStripe};

import {StripeConstructor} from "../dist/stripe-js";

declare global {
interface Window {
// Stripe.js must be loaded directly from https://js.stripe.com/v3, which
// places a `Stripe` object on the window
Stripe?: StripeConstructor;
}
}
19 changes: 19 additions & 0 deletions tests/stripe/in/stripe-js/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "@stripe/stripe-js",
"version": "4.1.0",
"description": "Stripe.js loading utility",
"repository": "github:stripe/stripe-js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"typings": "lib/index.d.ts",
"author": "Stripe (https://www.stripe.com)",
"license": "MIT",
"homepage": "https://stripe.com/docs/js",
"files": [
"dist",
"lib"
],
"engines": {
"node": ">=12.16"
}
}

0 comments on commit 2c267a2

Please sign in to comment.