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 Failing CI #556

Merged
merged 1 commit into from
Jun 23, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import browserEnv from '@ikscodes/browser-env';
import { MagicPayloadMethod } from '@magic-sdk/types';

import { SDKEnvironment } from '@magic-sdk/provider/src/core/sdk-environment';
import { isPromiEvent } from '../../../../src/util';
import { createMagicSDK, createMagicSDKTestMode } from '../../../factories';

Expand Down Expand Up @@ -63,3 +64,22 @@ test('method should return a PromiEvent', () => {
const magic = createMagicSDK();
expect(isPromiEvent(magic.auth.loginWithMagicLink({ email: 'blag' }))).toBeTruthy();
});

test('Throws error when the SDK version is 19 or higher', async () => {
const magic = createMagicSDK();
magic.auth.request = jest.fn();

// Set SDKEnvironment version to 19
SDKEnvironment.version = '19';
SDKEnvironment.sdkName = '@magic-sdk/react-native';

// Try to invoke the loginWithMagicLink method
try {
await magic.auth.loginWithMagicLink({ email: 'test' });
} catch (err) {
// Check if the error message is as expected
expect(err.message).toBe(
'loginWithMagicLink() is deprecated for this package, please utlize a passcode method like loginWithSMS or loginWithEmailOTP instead.',
);
}
});