@ -1,12 +1,11 @@
import { strict as assert } from 'assert' ;
import { TRANSACTION _TYPES } from '../../../shared/constants/transaction' ;
import { TRANSACTION _TYPES } from '../../../shared/constants/transaction' ;
import { MAINNET _CHAIN _ID } from '../../../shared/constants/network' ;
import { MAINNET _CHAIN _ID } from '../../../shared/constants/network' ;
import migration64 from './064' ;
import migration64 from './064' ;
const SENT _ETHER = 'sentEther' ; // the legacy transaction type being replaced in this migration with TRANSACTION_TYPES.SIMPLE_SEND
const SENT _ETHER = 'sentEther' ; // the legacy transaction type being replaced in this migration with TRANSACTION_TYPES.SIMPLE_SEND
describe ( 'migration #64' , function ( ) {
describe ( 'migration #64' , ( ) => {
it ( 'should update the version metadata' , async function ( ) {
it ( 'should update the version metadata' , async ( ) => {
const oldStorage = {
const oldStorage = {
meta : {
meta : {
version : 63 ,
version : 63 ,
@ -15,12 +14,12 @@ describe('migration #64', function () {
} ;
} ;
const newStorage = await migration64 . migrate ( oldStorage ) ;
const newStorage = await migration64 . migrate ( oldStorage ) ;
assert . deepEqual ( newStorage . meta , {
expect ( newStorage . meta ) . toStrictEqual ( {
version : 64 ,
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 = {
const oldStorage = {
meta : { } ,
meta : { } ,
data : {
data : {
@ -35,10 +34,10 @@ describe('migration #64', function () {
} ;
} ;
const newStorage = await migration64 . migrate ( oldStorage ) ;
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 = {
const oldStorage = {
meta : { } ,
meta : { } ,
data : {
data : {
@ -51,10 +50,10 @@ describe('migration #64', function () {
} ;
} ;
const newStorage = await migration64 . migrate ( oldStorage ) ;
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 = {
const oldStorage = {
meta : { } ,
meta : { } ,
data : {
data : {
@ -67,20 +66,20 @@ describe('migration #64', function () {
} ;
} ;
const newStorage = await migration64 . migrate ( oldStorage ) ;
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 = {
const oldStorage = {
meta : { } ,
meta : { } ,
data : { } ,
data : { } ,
} ;
} ;
const newStorage = await migration64 . migrate ( oldStorage ) ;
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 = {
const OLD _TRANSACTION _STATE = {
1462177651588364 : {
1462177651588364 : {
type : TRANSACTION _TYPES . CANCEL ,
type : TRANSACTION _TYPES . CANCEL ,
@ -464,6 +463,6 @@ describe('migration #64', function () {
const newStorage = await migration64 . migrate ( oldStorage ) ;
const newStorage = await migration64 . migrate ( oldStorage ) ;
assert . deepEqual ( expectedStorage . data , newStorage . data ) ;
expect ( expectedStorage . data ) . toStrictEqual ( newStorage . data ) ;
} ) ;
} ) ;
} ) ;
} ) ;