1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 09:57:02 +01:00

Jestify continue (#12173)

This commit is contained in:
Thomas Huang 2021-09-22 08:15:40 -07:00 committed by GitHub
parent 5c842107b9
commit 1cc45774dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 50 deletions

View File

@ -1,7 +1,7 @@
import migration58 from './058';
describe('migration #58', function () {
it('should update the version metadata', async function () {
describe('migration #58', () => {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 57,
@ -15,8 +15,8 @@ describe('migration #58', function () {
});
});
describe('deleting swapsWelcomeMessageHasBeenShown', function () {
it('should delete the swapsWelcomeMessageHasBeenShown property', async function () {
describe('deleting swapsWelcomeMessageHasBeenShown', () => {
it('should delete the swapsWelcomeMessageHasBeenShown property', async () => {
const oldStorage = {
meta: {},
data: {
@ -31,7 +31,7 @@ describe('migration #58', function () {
expect(newStorage.data.AppStateController).toStrictEqual({ bar: 'baz' });
});
it('should not modify state if the AppStateController does not exist', async function () {
it('should not modify state if the AppStateController does not exist', async () => {
const oldStorage = {
meta: {},
data: {

View File

@ -122,8 +122,8 @@ const ERRONEOUS_TRANSACTION_STATE_MIXED = {
},
};
describe('migration #59', function () {
it('should update the version metadata', async function () {
describe('migration #59', () => {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 58,
@ -137,7 +137,7 @@ describe('migration #59', function () {
});
});
it('should drop orphaned cancel transactions', async function () {
it('should drop orphaned cancel transactions', async () => {
const oldStorage = {
meta: {},
data: {
@ -159,7 +159,7 @@ describe('migration #59', function () {
});
});
it('should drop orphaned cancel transactions even if a nonce exists on another network that is confirmed', async function () {
it('should drop orphaned cancel transactions even if a nonce exists on another network that is confirmed', async () => {
const oldStorage = {
meta: {},
data: {
@ -191,7 +191,7 @@ describe('migration #59', function () {
});
});
it('should not drop cancel transactions with matching non cancel or retry in same network and nonce', async function () {
it('should not drop cancel transactions with matching non cancel or retry in same network and nonce', async () => {
const oldStorage = {
meta: {},
data: {
@ -218,7 +218,7 @@ describe('migration #59', function () {
});
});
it('should drop orphaned retry transactions', async function () {
it('should drop orphaned retry transactions', async () => {
const oldStorage = {
meta: {},
data: {
@ -240,7 +240,7 @@ describe('migration #59', function () {
});
});
it('should drop orphaned retry transactions even if a nonce exists on another network that is confirmed', async function () {
it('should drop orphaned retry transactions even if a nonce exists on another network that is confirmed', async () => {
const oldStorage = {
meta: {},
data: {
@ -272,7 +272,7 @@ describe('migration #59', function () {
});
});
it('should not drop retry transactions with matching non cancel or retry in same network and nonce', async function () {
it('should not drop retry transactions with matching non cancel or retry in same network and nonce', async () => {
const oldStorage = {
meta: {},
data: {
@ -299,7 +299,7 @@ describe('migration #59', function () {
});
});
it('should drop all orphaned retry and cancel transactions', async function () {
it('should drop all orphaned retry and cancel transactions', async () => {
const oldStorage = {
meta: {},
data: {
@ -324,7 +324,7 @@ describe('migration #59', function () {
});
});
it('should do nothing if transactions state does not exist', async function () {
it('should do nothing if transactions state does not exist', async () => {
const oldStorage = {
meta: {},
data: {
@ -342,7 +342,7 @@ describe('migration #59', function () {
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('should do nothing if transactions state is empty', async function () {
it('should do nothing if transactions state is empty', async () => {
const oldStorage = {
meta: {},
data: {
@ -358,7 +358,7 @@ describe('migration #59', function () {
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('should do nothing if transactions state is not an object', async function () {
it('should do nothing if transactions state is not an object', async () => {
const oldStorage = {
meta: {},
data: {
@ -374,7 +374,7 @@ describe('migration #59', function () {
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('should do nothing if state is empty', async function () {
it('should do nothing if state is empty', async () => {
const oldStorage = {
meta: {},
data: {},

View File

@ -1,7 +1,7 @@
import migration60 from './060';
describe('migration #60', function () {
it('should update the version metadata', async function () {
describe('migration #60', () => {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 59,
@ -15,7 +15,7 @@ describe('migration #60', function () {
});
});
it('prunes the support notification', async function () {
it('prunes the support notification', async () => {
const oldStorage = {
meta: {},
data: {
@ -62,7 +62,7 @@ describe('migration #60', function () {
});
});
it('does not modify state when the support notification does not exist', async function () {
it('does not modify state when the support notification does not exist', async () => {
const oldStorage = {
meta: {},
data: {
@ -99,7 +99,7 @@ describe('migration #60', function () {
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('does not modify state when NotificationsController is undefined', async function () {
it('does not modify state when NotificationsController is undefined', async () => {
const oldStorage = {
meta: {},
data: {
@ -112,7 +112,7 @@ describe('migration #60', function () {
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('does not modify state when notifications are undefined', async function () {
it('does not modify state when notifications are undefined', async () => {
const oldStorage = {
meta: {},
data: {
@ -126,7 +126,7 @@ describe('migration #60', function () {
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('does not modify state when notifications are not an object', async function () {
it('does not modify state when notifications are not an object', async () => {
const oldStorage = {
meta: {},
data: {

View File

@ -1,18 +1,18 @@
import sinon from 'sinon';
import migration61 from './061';
describe('migration #61', function () {
describe('migration #61', () => {
let dateStub;
beforeEach(function () {
beforeEach(() => {
dateStub = sinon.stub(Date.prototype, 'getTime').returns(1621580400000);
});
afterEach(function () {
afterEach(() => {
dateStub.restore();
});
it('should update the version metadata', async function () {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 60,
@ -26,7 +26,7 @@ describe('migration #61', function () {
});
});
it('should set recoveryPhraseReminderHasBeenShown to false and recoveryPhraseReminderLastShown to the current time', async function () {
it('should set recoveryPhraseReminderHasBeenShown to false and recoveryPhraseReminderLastShown to the current time', async () => {
const oldStorage = {
meta: {},
data: {
@ -46,7 +46,7 @@ describe('migration #61', function () {
});
});
it('should initialize AppStateController if it does not exist', async function () {
it('should initialize AppStateController if it does not exist', async () => {
const oldStorage = {
meta: {},
data: {

View File

@ -1,7 +1,7 @@
import migration62 from './062';
describe('migration #62', function () {
it('should update the version metadata', async function () {
describe('migration #62', () => {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 61,
@ -15,7 +15,7 @@ describe('migration #62', function () {
});
});
it('should remove metaMetricsSendCount from MetaMetricsController', async function () {
it('should remove metaMetricsSendCount from MetaMetricsController', async () => {
const oldStorage = {
meta: {},
data: {
@ -36,7 +36,7 @@ describe('migration #62', function () {
});
});
it('should remove metaMetricsSendCount from MetaMetricsController (falsey but defined)', async function () {
it('should remove metaMetricsSendCount from MetaMetricsController (falsey but defined)', async () => {
const oldStorage = {
meta: {},
data: {
@ -57,7 +57,7 @@ describe('migration #62', function () {
});
});
it('should not modify MetaMetricsController when metaMetricsSendCount is undefined', async function () {
it('should not modify MetaMetricsController when metaMetricsSendCount is undefined', async () => {
const oldStorage = {
meta: {},
data: {

View File

@ -1,12 +1,11 @@
import { strict as assert } from 'assert';
import { TRANSACTION_TYPES } from '../../../shared/constants/transaction';
import { MAINNET_CHAIN_ID } from '../../../shared/constants/network';
import migration64 from './064';
const SENT_ETHER = 'sentEther'; // the legacy transaction type being replaced in this migration with TRANSACTION_TYPES.SIMPLE_SEND
describe('migration #64', function () {
it('should update the version metadata', async function () {
describe('migration #64', () => {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 63,
@ -15,12 +14,12 @@ describe('migration #64', function () {
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(newStorage.meta, {
expect(newStorage.meta).toStrictEqual({
version: 64,
});
});
it('should do nothing if transactions state does not exist', async function () {
it('should do nothing if transactions state does not exist', async () => {
const oldStorage = {
meta: {},
data: {
@ -35,10 +34,10 @@ describe('migration #64', function () {
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(oldStorage.data, newStorage.data);
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('should do nothing if transactions state is empty', async function () {
it('should do nothing if transactions state is empty', async () => {
const oldStorage = {
meta: {},
data: {
@ -51,10 +50,10 @@ describe('migration #64', function () {
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(oldStorage.data, newStorage.data);
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('should do nothing if transactions state is not an object', async function () {
it('should do nothing if transactions state is not an object', async () => {
const oldStorage = {
meta: {},
data: {
@ -67,20 +66,20 @@ describe('migration #64', function () {
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(oldStorage.data, newStorage.data);
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('should do nothing if state is empty', async function () {
it('should do nothing if state is empty', async () => {
const oldStorage = {
meta: {},
data: {},
};
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(oldStorage.data, newStorage.data);
expect(oldStorage.data).toStrictEqual(newStorage.data);
});
it('should change action type of "sentEther" to "simpleSend" for any transactions and transaction history events in transactionsController.transactions', async function () {
it('should change action type of "sentEther" to "simpleSend" for any transactions and transaction history events in transactionsController.transactions', async () => {
const OLD_TRANSACTION_STATE = {
1462177651588364: {
type: TRANSACTION_TYPES.CANCEL,
@ -464,6 +463,6 @@ describe('migration #64', function () {
const newStorage = await migration64.migrate(oldStorage);
assert.deepEqual(expectedStorage.data, newStorage.data);
expect(expectedStorage.data).toStrictEqual(newStorage.data);
});
});