Skip to content

Commit

Permalink
chore: updated stripe web sdk tests for node18
Browse files Browse the repository at this point in the history
  • Loading branch information
dackers86 committed Aug 16, 2023
1 parent 6db5e0e commit 0b534c0
Show file tree
Hide file tree
Showing 8 changed files with 225 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
retry_wait_seconds: 60
max_attempts: 3
command: npm i -g firebase-tools
- name: Override NODE options for the most recent version
if: matrix.node == '16'
run: echo "NODE_OPTIONS=--openssl-legacy-provider" >> $GITHUB_ENV
- name: mask env paramaters
run: echo "::add-mask::$STRIPE_WEBHOOK_SECRET"
- name: Run tests with coverage
Expand Down
5 changes: 5 additions & 0 deletions firestore-stripe-web-sdk/_emulator/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "extensions-testing"
}
}
66 changes: 66 additions & 0 deletions firestore-stripe-web-sdk/_emulator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*
firebase-debug.*.log*

# Firebase cache
.firebase/

# Firebase config

# Uncomment this if you'd like others to create their own Firebase project.
# For a team working on the same Firebase project(s), it is recommended to leave
# it commented so all members can deploy to the same project(s) in .firebaserc.
# .firebaserc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
19 changes: 19 additions & 0 deletions firestore-stripe-web-sdk/_emulator/firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"emulators": {
"firestore": {
"port": 8080,
"host": "0.0.0.0"
},
"auth": {
"port": 9099,
"host": "0.0.0.0"
},
"ui": {
"enabled": true
}
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
}
}
123 changes: 123 additions & 0 deletions firestore-stripe-web-sdk/_emulator/firestore.indexes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"indexes": [
{
"collectionGroup": "acknowledgements",
"queryScope": "COLLECTION_GROUP",
"fields": [
{
"fieldPath": "ackEvent",
"order": "ASCENDING"
},
{
"fieldPath": "userId",
"order": "ASCENDING"
},
{
"fieldPath": "createdAt",
"order": "DESCENDING"
}
]
},
{
"collectionGroup": "acknowledgements",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "userId",
"order": "ASCENDING"
},
{
"fieldPath": "createdAt",
"order": "DESCENDING"
}
]
},
{
"collectionGroup": "notices",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "type",
"order": "ASCENDING"
},
{
"fieldPath": "createdAt",
"order": "DESCENDING"
}
]
},
{
"collectionGroup": "notices",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "type",
"order": "ASCENDING"
},
{
"fieldPath": "version",
"order": "ASCENDING"
},
{
"fieldPath": "createdAt",
"order": "DESCENDING"
}
]
},
{
"collectionGroup": "queued_writes",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "state",
"order": "ASCENDING"
},
{
"fieldPath": "deliverTime",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "queued_writes",
"queryScope": "COLLECTION",
"fields": [
{
"fieldPath": "state",
"order": "ASCENDING"
},
{
"fieldPath": "leaseExpireTime",
"order": "ASCENDING"
}
]
},
{
"collectionGroup": "reviews",
"queryScope": "COLLECTION_GROUP",
"fields": [
{
"fieldPath": "Id",
"order": "ASCENDING"
},
{
"fieldPath": "Desription",
"order": "ASCENDING"
}
]
}
],
"fieldOverrides": [
{
"collectionGroup": "subcollection",
"fieldPath": "foo",
"ttl": false,
"indexes": [
{
"order": "ASCENDING",
"queryScope": "COLLECTION_GROUP"
}
]
}
]
}
8 changes: 8 additions & 0 deletions firestore-stripe-web-sdk/_emulator/firestore.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
2 changes: 1 addition & 1 deletion firestore-stripe-web-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"api-extractor:local": "npm run build && api-extractor run --local --verbose",
"build": "tsc",
"postbuild": "node ./postbuild.js",
"test": "firebase emulators:exec --only firestore,auth --project fake-project-id 'npm run test:unit' && exit 0",
"test": "cd _emulator && firebase emulators:exec --project=demo-test 'NODE_OPTIONS=--openssl-legacy-provider npm run test:unit' && exit 0",
"test:unit": "karma start --single-run"
},
"keywords": [
Expand Down
1 change: 0 additions & 1 deletion firestore-stripe-web-sdk/test/emulator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ describe("Emulator tests", () => {
connectAuthEmulator(auth, "http://localhost:9099", {
disableWarnings: true,
});

for (const [productId, data] of Object.entries(rawProductData)) {
await addProductData(productId, data);
}
Expand Down

0 comments on commit 0b534c0

Please sign in to comment.