Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check CI device tags #5448

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b8983f5
Initial commit
takameyer May 31, 2022
4a2bf85
Documenting guidelines for testing & refactoring accordingly (#4584)
kraenhansen Jun 1, 2022
73a495b
Test Migration: Alias tests (#4581)
takameyer Jun 2, 2022
10d9596
Add migration tests (#5285)
gagik Jan 19, 2023
7605056
Migrate set tests to integration tests (#5290)
gagik Jan 24, 2023
307de57
Move list tests to ts (#5287)
JacobOscarGunnarsson Jan 24, 2023
5bf70db
move app tests to typescript (#5297)
JacobOscarGunnarsson Jan 24, 2023
2045aef
remove mistakenly added duplicates of apps
Jan 25, 2023
9df393c
Test Migration: Results Tests (#5325)
gagik Jan 26, 2023
b5ceb44
move mixed tests to integration tests (#5256)
JacobOscarGunnarsson Jan 27, 2023
ee90b58
Move array-buffer tests to integration tests (#5255)
JacobOscarGunnarsson Jan 27, 2023
3a394f0
use correct baseurl for tests (#5337)
JacobOscarGunnarsson Jan 30, 2023
aee6eb1
migrate dictionary tests to ts (#5254)
JacobOscarGunnarsson Jan 31, 2023
d288982
move linking-objects tests to ts (#5268)
JacobOscarGunnarsson Feb 1, 2023
16d81b0
Test Migration: User Tests (#5324)
JacobOscarGunnarsson Feb 1, 2023
1d0b839
Test Migration: Queries test (#5299)
gagik Feb 2, 2023
6ce7c99
Test Migration: Notification Tests (#5347)
gagik Feb 2, 2023
e5812a0
Add a debug launcher for integration tests
takameyer Feb 9, 2023
d6061dd
Fix the mongo client tests for local baas
takameyer Feb 9, 2023
eeef08e
fix queries test, make test errors more verbose
Feb 9, 2023
1a61fa1
Remove Chrome Debugger and fix package-lock problems (#5403)
takameyer Feb 10, 2023
4712fbf
Pushed Chrome Debugger Removal with Lint errors (#5414)
takameyer Feb 10, 2023
03b8e92
Andrew/tests/fix-watch (#5412)
takameyer Feb 10, 2023
fd9b387
Remove lock files
takameyer Feb 10, 2023
0242009
Migrate object-tests to TS (#5348)
JacobOscarGunnarsson Feb 13, 2023
7a22208
test migration: open-behaviour (#5365)
JacobOscarGunnarsson Feb 13, 2023
1323710
test migration: mixed-sync-test (#5398)
JacobOscarGunnarsson Feb 13, 2023
9e1b3e7
migrate encryption tests to TS (#5362)
JacobOscarGunnarsson Feb 13, 2023
a53f352
migrate sync-based UUID, Dictionary and Set tests (#5356)
gagik Feb 13, 2023
0b0f351
migrate realm tests to TS (#5352)
JacobOscarGunnarsson Feb 13, 2023
6ffba74
migrate partition-values tests to TS (#5359)
JacobOscarGunnarsson Feb 13, 2023
b554d22
test migration: session tests (#5391)
JacobOscarGunnarsson Feb 17, 2023
850bd0c
Fix issues with migrated integration tests, add select helper method.…
JacobOscarGunnarsson Feb 17, 2023
b8d9c11
Refactored the importApp hook
kraenhansen Feb 17, 2023
c2864ac
Remove BSON as a dependency from tests
gagik Feb 15, 2023
47a0533
Fixed import app hook 🤞
kraenhansen Feb 17, 2023
a24fafb
[fast] Test
gagik Feb 17, 2023
1e3f9f8
Test one exclude
gagik Feb 17, 2023
7900688
Test.
gagik Feb 17, 2023
62db885
Use sequence
gagik Feb 17, 2023
5ca368e
Another attempt
gagik Feb 17, 2023
110dad8
[fast] another attempt
gagik Feb 17, 2023
50643aa
Test reusable
gagik Feb 17, 2023
503b142
Use different formatting
gagik Feb 17, 2023
765d972
Use actions
gagik Feb 17, 2023
d36f443
with version
gagik Feb 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
move app tests to typescript (#5297)
  • Loading branch information
JacobOscarGunnarsson authored and kraenhansen committed Feb 17, 2023
commit 5bf70db0b02f0e36dc0194af6627da3fafa2f1b9
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "api-key",
"type": "api-key",
"disabled": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "local-userpass",
"type": "local-userpass",
"config": {
"autoConfirm": true,
"resetPasswordUrl": "http://localhost/resetPassword"
},
"disabled": false
}
4 changes: 4 additions & 0 deletions integration-tests/realm-apps/with-api-key/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "with-api-key",
"config_version": 20200603
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "custom-function",
"type": "custom-function",
"config": {
"authFunctionName": "customAuthentication"
},
"disabled": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "with-custom-function",
"config_version": 20200603
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "customAuthentication",
"private": true,
"run_as_system": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2020 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

/* eslint-env node */
/* global context */

exports = async function (loginPayload) {
// Get a handle for the app.users collection
const users = context.services.get("local-mongodb").db("app").collection("users");

// Parse out custom data from the FunctionCredential

const { username, secret } = loginPayload;

if (secret !== "v3ry-s3cret") {
throw new Error("Ah ah ah, you didn't say the magic word");
}
// Query for an existing user document with the specified username

const user = await users.findOne({ username });

if (user) {
// If the user document exists, return its unique ID
return user._id.toString();
} else {
// If the user document does not exist, create it and then return its unique ID
const result = await users.insertOne({ username });
return result.insertedId.toString();
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"local-mongodb-uri": "mongodb://localhost:26000"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "local-mongodb",
"type": "mongodb",
"config": {},
"secret_config": {
"uri": "local-mongodb-uri"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "local-userpass",
"type": "local-userpass",
"config": {
"autoConfirm": true,
"resetPasswordUrl": "http://localhost/resetPassword"
},
"disabled": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "with-email-password",
"config_version": 20200603
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "custom-token",
"type": "custom-token",
"config": {
"audience": "",
"signingAlgorithm": "HS256",
"useJWKURI": false
},
"secret_config": {
"signingKeys": [
"jwt-secret"
]
},
"disabled": false,
"metadata_fields": [
{
"required": true,
"name": "mySecretField",
"field_name": "secret"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "with-jwt",
"config_version": 20200603
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"jwt-secret": "2k66QfKeTRk3MdZ5vpDYgZCu2k66QfKeTRk3MdZ5vpDYgZCu",
"local-mongodb-uri": "mongodb://localhost:26000"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "custom-function",
"type": "custom-function",
"config": {
"authFunctionName": "customAuthentication"
},
"disabled": false
}
4 changes: 4 additions & 0 deletions integration-tests/realm-apps/with-custom-function/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "with-custom-function",
"config_version": 20200603
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "customAuthentication",
"private": true,
"run_as_system": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
////////////////////////////////////////////////////////////////////////////
//
// Copyright 2020 Realm Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////

/* eslint-env node */
/* global context */

exports = async function (loginPayload) {
// Get a handle for the app.users collection
const users = context.services.get("local-mongodb").db("app").collection("users");

// Parse out custom data from the FunctionCredential

const { username, secret } = loginPayload;

if (secret !== "v3ry-s3cret") {
throw new Error("Ah ah ah, you didn't say the magic word");
}
// Query for an existing user document with the specified username

const user = await users.findOne({ username });

if (user) {
// If the user document exists, return its unique ID
return user._id.toString();
} else {
// If the user document does not exist, create it and then return its unique ID
const result = await users.insertOne({ username });
return result.insertedId.toString();
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"local-mongodb-uri": "mongodb://localhost:26000"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "local-mongodb",
"type": "mongodb",
"config": {},
"secret_config": {
"uri": "local-mongodb-uri"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "local-userpass",
"type": "local-userpass",
"config": {
"autoConfirm": true,
"resetPasswordUrl": "http://localhost/resetPassword"
},
"disabled": false
}
4 changes: 4 additions & 0 deletions integration-tests/realm-apps/with-email-password/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "with-email-password",
"config_version": 20200603
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "custom-token",
"type": "custom-token",
"config": {
"audience": "",
"signingAlgorithm": "HS256",
"useJWKURI": false
},
"secret_config": {
"signingKeys": [
"jwt-secret"
]
},
"disabled": false,
"metadata_fields": [
{
"required": true,
"name": "mySecretField",
"field_name": "secret"
}
]
}
4 changes: 4 additions & 0 deletions integration-tests/realm-apps/with-jwt/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "with-jwt",
"config_version": 20200603
}
4 changes: 4 additions & 0 deletions integration-tests/realm-apps/with-jwt/secrets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"jwt-secret": "2k66QfKeTRk3MdZ5vpDYgZCu2k66QfKeTRk3MdZ5vpDYgZCu",
"local-mongodb-uri": "mongodb://localhost:26000"
}
4 changes: 3 additions & 1 deletion integration-tests/tests/src/hooks/import-app-before.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export function importAppBefore(
if (this.app) {
throw new Error("Unexpected app on context, use only one importAppBefore per test");
} else {
this.app = await importApp(name, replacements);
const { appId, baseUrl } = await importApp(name, replacements);
this.app = new Realm.App({ id: appId, baseUrl });

Realm.App.Sync.setLogLevel(this.app, logLevel);
// Set a default logger as Android does not forward stdout
Realm.App.Sync.setLogger(this.app, (level, message) => {
Expand Down
1 change: 1 addition & 0 deletions integration-tests/tests/src/tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import "./sync/mixed";
import "./sync/flexible";
import "./sync/asymmetric";
import "./sync/sync-as-local";
import "./sync/app";
import "./transaction";
import "./schema";
import "./types";
Expand Down
Loading