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

Fix crash when showing lock for the second time with custom select input #1448

Merged
merged 2 commits into from
Jul 26, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
23 changes: 23 additions & 0 deletions src/__tests__/engine/classic.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const getClassic = () => require('engine/classic').default;

describe('Classic Engine', () => {
beforeEach(() => {
jest.mock('connection/database/index', () => ({
resolveAdditionalSignUpFields: m => ({ ...m, resolveAdditionalSignUpFields: true }),
overrideDatabaseOptions: m => ({ ...m, overrideDatabaseOptions: true })
}));
jest.mock('sync', () => ({
isSuccess: () => false
}));
});
test('willShow calls `resolveAdditionalSignUpFields`', () => {
const classic = getClassic();
const model = classic.willShow(model, {});
expect(model.resolveAdditionalSignUpFields).toBe(true);
});
test('willShow calls `overrideDatabaseOptions`', () => {
const classic = getClassic();
const model = classic.willShow(model, {});
expect(model.overrideDatabaseOptions).toBe(true);
});
});
4 changes: 3 additions & 1 deletion src/engine/classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import {
hasInitialScreen,
hasScreen,
initDatabase,
overrideDatabaseOptions
overrideDatabaseOptions,
resolveAdditionalSignUpFields
} from '../connection/database/index';
import {
defaultEnterpriseConnection,
Expand Down Expand Up @@ -151,6 +152,7 @@ class Classic {

willShow(m, opts) {
m = overrideDatabaseOptions(m, opts);
m = resolveAdditionalSignUpFields(m);
if (isSuccess(m, 'client')) {
m = validateAllowedConnections(m);
}
Expand Down