Skip to content

Commit

Permalink
Merge branch 'develop' into refactor-token-decimals-fetch-logic-and-m…
Browse files Browse the repository at this point in the history
…emoize
  • Loading branch information
digiwand authored Sep 12, 2024
2 parents 09a9fee + dfc12b6 commit dba0ba3
Show file tree
Hide file tree
Showing 58 changed files with 2,257 additions and 113 deletions.
3 changes: 0 additions & 3 deletions app/_locales/de/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/el/messages.json

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

45 changes: 42 additions & 3 deletions app/_locales/en/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/es/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/fr/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/hi/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/id/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/ja/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/ko/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/pt/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/ru/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/tl/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/tr/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/vi/messages.json

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

3 changes: 0 additions & 3 deletions app/_locales/zh_CN/messages.json

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

107 changes: 107 additions & 0 deletions app/scripts/migrations/125.1.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import { migrate, version } from './125.1';

const oldVersion = 125;

describe(`migration #${version}`, () => {
afterEach(() => jest.resetAllMocks());

it('updates the version metadata', async () => {
const oldStorage = {
meta: { version: oldVersion },
data: {},
};

const newStorage = await migrate(oldStorage);
expect(newStorage.meta).toStrictEqual({ version });
});

it('Gracefully handles empty/undefined PreferencesController', async () => {
for (const PreferencesController of [{}, undefined, null, 1, '', []]) {
const oldStorage = {
meta: { version: oldVersion },
data: { PreferencesController },
};

const newStorage = await migrate(oldStorage);
expect(newStorage.data.TxController).toStrictEqual(undefined);
}
});

it('Enables token autodetection when basic functionality is on', async () => {
const oldStorage = {
meta: { version: oldVersion },
data: {
PreferencesController: {
useExternalServices: true,
},
},
};

const newStorage = await migrate(oldStorage);
expect(newStorage.data).toEqual({
PreferencesController: {
useExternalServices: true,
useTokenDetection: true,
},
});
});

it('Does not enable token autodetection when basic functionality is off', async () => {
const oldStorage = {
meta: { version: oldVersion },
data: {
PreferencesController: {
useExternalServices: false,
},
},
};

const newStorage = await migrate(oldStorage);
expect(newStorage.data).toEqual({
PreferencesController: {
useExternalServices: false,
},
});
});

it('Removes showTokenAutodetectModalOnUpgrade from the app metadata controller', async () => {
const oldStorage = {
meta: { version: oldVersion },
data: {
AppMetadataController: {
previousMigrationVersion: oldVersion,
currentMigrationVersion: version,
showTokenAutodetectModalOnUpgrade: null,
},
},
};

const newStorage = await migrate(oldStorage);
expect(newStorage.data).toEqual({
AppMetadataController: {
previousMigrationVersion: oldVersion,
currentMigrationVersion: version,
},
});
});

it('Does nothing if showTokenAutodetectModalOnUpgrade is not in the app metadata controller', async () => {
const oldStorage = {
meta: { version: oldVersion },
data: {
AppMetadataController: {
previousMigrationVersion: oldVersion,
currentMigrationVersion: version,
},
},
};

const newStorage = await migrate(oldStorage);
expect(newStorage.data).toEqual({
AppMetadataController: {
previousMigrationVersion: oldVersion,
currentMigrationVersion: version,
},
});
});
});
Loading

0 comments on commit dba0ba3

Please sign in to comment.