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

test: thirdpary config #725

Merged
merged 3 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [16.3.3] - 2023-10-19

- Tests `null` values in `ProviderConfig` saved in core

## [16.3.2] - 2023-10-16

### Fixes
Expand Down
18 changes: 18 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ You will need to setup the `supertokens-core` in order to to run the `supertoken
5. If all tests pass the output should be:
![node tests passing](https://github.com/supertokens/supertokens-logo/blob/master/images/supertokens-node-tests-passing.png)

### To be able to run and debug tests from vscode

1. Install the extension - https://marketplace.visualstudio.com/items?itemName=hbenl.vscode-mocha-test-adapter
2. Add the following to your vscode settings:
```json
{
// ...,
"mochaExplorer.env": {
"TEST_MODE": "testing",
"INSTALL_PATH": "../supertokens-root"
}
}
```
3. In `lib/tsconfig.json`, change `"sourceMap"` to `true`
4. Run `npm run build`

You should now be able to see tests on the VSCode's testing panel and run/debug from there.

## Pull Request

1. Before submitting a pull request make sure all tests have passed
Expand Down
2 changes: 1 addition & 1 deletion lib/build/version.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/build/version.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/ts/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*/
export const version = "16.3.2";
export const version = "16.3.3";

export const cdiSupported = ["4.0"];

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supertokens-node",
"version": "16.3.2",
"version": "16.3.3",
"description": "NodeJS driver for SuperTokens core",
"main": "index.js",
"scripts": {
Expand Down
68 changes: 68 additions & 0 deletions test/multitenancy/tenants-crud.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,74 @@ describe(`tenants-crud: ${printPath("[test/multitenancy/tenants-crud.test.js]")}
assert(tenantConfig.thirdParty.providers[0].clients[0].clientId === "abcd");
});

it("test creation of thirdParty config with nulls", async function () {
const connectionURI = await startSTWithMultitenancy();
SuperTokens.init({
supertokens: {
connectionURI,
},
appInfo: {
apiDomain: "api.supertokens.io",
appName: "SuperTokens",
websiteDomain: "supertokens.io",
},
recipeList: [Multitenancy.init()],
});

const app = express();

app.use(middleware());
app.use(errorHandler());

await Multitenancy.createOrUpdateTenant("t1", { emailPasswordEnabled: true });

const thirdPartyConfig = {
thirdPartyId: "google",
clients: [{ clientId: "abcd" }],
authorizationEndpointQueryParams: {
key1: null,
key2: "value",
},
tokenEndpointBodyParams: {
key1: null,
key2: "value",
},
userInfoEndpointQueryParams: {
key1: null,
key2: "value",
},
userInfoEndpointHeaders: {
key1: null,
key2: "value",
},
};

await Multitenancy.createOrUpdateThirdPartyConfig("t1", thirdPartyConfig);

const tenantConfig = await Multitenancy.getTenant("t1");

assert(tenantConfig.thirdParty.providers.length === 1);
assert(tenantConfig.thirdParty.providers[0].thirdPartyId === "google");
assert(tenantConfig.thirdParty.providers[0].clients.length === 1);
assert(tenantConfig.thirdParty.providers[0].clients[0].clientId === "abcd");
assert.deepEqual(
tenantConfig.thirdParty.providers[0].authorizationEndpointQueryParams,
thirdPartyConfig.authorizationEndpointQueryParams
);
assert.deepEqual(
tenantConfig.thirdParty.providers[0].tokenEndpointBodyParams,
thirdPartyConfig.tokenEndpointBodyParams
);
assert.deepEqual(
tenantConfig.thirdParty.providers[0].userInfoEndpointQueryParams,
thirdPartyConfig.userInfoEndpointQueryParams
);
assert.deepEqual(
tenantConfig.thirdParty.providers[0].userInfoEndpointHeaders,
thirdPartyConfig.userInfoEndpointHeaders
);
});

it("test deletion of thirdparty id", async function () {
const connectionURI = await startSTWithMultitenancy();
SuperTokens.init({
Expand Down
Loading