Skip to content
Closed
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
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,16 @@ workflows:
workflow: test_pull_request
requires:
- Build (PR)
- integration-test:
name: Integration Test Jest - Servers - Auth (PR)
nx_run: affected --base=main --head=$CIRCLE_SHA1
projects: --exclude '*,!tag:scope:server:auth'
start_customs: true
target: -t test-integration-jest
test_suite: servers-auth-jest-integration
workflow: test_pull_request
requires:
- Build (PR)
- integration-test:
name: Integration Test - Libraries (PR)
nx_run: affected --base=main --head=$CIRCLE_SHA1
Expand All @@ -988,6 +998,7 @@ workflows:
- Integration Test - Servers (PR)
- Integration Test - Servers - Auth (PR)
- Integration Test - Servers - Auth V2 (PR)
- Integration Test Jest - Servers - Auth (PR)
- Integration Test - Libraries (PR)
- Firefox Functional Tests - Playwright (PR)

Expand Down Expand Up @@ -1174,6 +1185,21 @@ workflows:
nx_run: run-many --no-cloud
requires:
- Build
- integration-test:
name: Integration Test Jest - Servers - Auth
projects: --exclude '*,!tag:scope:server:auth'
start_customs: true
target: -t test-integration-jest
test_suite: servers-auth-jest-integration
workflow: test_and_deploy_tag
filters:
branches:
ignore: /.*/
tags:
only: /.*/
nx_run: run-many --no-cloud
requires:
- Build
- integration-test:
name: Integration Test - Libraries
projects: --exclude '*,!tag:scope:shared:*'
Expand Down
11 changes: 11 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,17 @@
],
"cache": true
},
"test-integration-jest": {
"dependsOn": ["build", "gen-keys"],
"inputs": ["test", "^test"],
"outputs": [
"{workspaceRoot}/artifacts/tests",
"{projectRoot}/coverage",
"{projectRoot}/.nyc_output",
"{projectRoot}/test-results.xml"
],
"cache": true
},
"test-unit": {
"dependsOn": ["build", "gen-keys"],
"inputs": ["test", "^test"],
Expand Down
11 changes: 11 additions & 0 deletions packages/fxa-auth-server/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,16 @@
"dist",
"fxa-*",
"vendor"
],
"overrides": [
{
"files": ["**/*.spec.ts"],
"env": {
"jest": true
},
"rules": {
"fxa/async-crypto-random": "off"
}
}
]
}
48 changes: 48 additions & 0 deletions packages/fxa-auth-server/config/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

describe('Config', () => {
describe('NODE_ENV=prod', () => {
let originalEnv: Record<string, string | undefined>;

function mockEnv(key: string, value: string) {
originalEnv[key] = process.env[key];
process.env[key] = value;
}

beforeEach(() => {
originalEnv = {};
jest.resetModules();
mockEnv('NODE_ENV', 'prod');
});

afterEach(() => {
for (const key in originalEnv) {
if (originalEnv[key] === undefined) {
delete process.env[key];
} else {
process.env[key] = originalEnv[key];
}
}
});

it('errors when secret settings have their default values', () => {
expect(() => {
require('./index');
}).toThrow(/Config '[a-zA-Z._]+' must be set in production/);
});

it('succeeds when secret settings have all been configured', () => {
mockEnv('FLOW_ID_KEY', 'production secret here');
mockEnv('OAUTH_SERVER_SECRET_KEY', 'production secret here');
mockEnv(
'PROFILE_SERVER_AUTH_SECRET_BEARER_TOKEN',
'production secret here'
);
expect(() => {
require('./index');
}).not.toThrow();
});
});
});
Loading
Loading