-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
108 additions
and
0 deletions.
There are no files selected for viewing
108 changes: 108 additions & 0 deletions
108
...ges/contract-helpers/src/V3-uiStakeDataProvider-contract-copy/uiStakeDataProvider.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import { BigNumber, providers } from 'ethers'; | ||
import { | ||
GeneralStakeUIDataHumanized, | ||
GeneralStakeUIDataRaw, | ||
GetUserStakeTotalsRaw, | ||
GetUserStakeUIDataHumanized, | ||
GetUserStakeUIDataRaw, | ||
} from './_mocks'; | ||
import { | ||
Abi as IStakedTokenDataProvider, | ||
Abi__factory as StakedTokenDataProvider__factory, | ||
} from './typechain'; | ||
import { | ||
StakedTokenData, | ||
HumanizedStakeResponse, | ||
// GeneralStakeUIData, | ||
// GeneralStakeUIDataHumanized, | ||
// GetUserStakeUIData, | ||
// GetUserStakeUIDataHumanized, | ||
} from './types'; | ||
|
||
describe('UiStakeDataProvider', () => { | ||
const user = '0x0000000000000000000000000000000000000001'; | ||
const uiStakeDataProvider = '0x0000000000000000000000000000000000000002'; | ||
const dataProvider: providers.Provider = new providers.JsonRpcProvider(); | ||
|
||
// jest.spyOn(StakedTokenDataProvider__factory, 'connect').mockReturnValue({ | ||
// // getGeneralStakeUIData: async () => Promise.resolve(GeneralStakeUIDataRaw), | ||
// // getUserStakeUIData: async () => Promise.resolve(GetUserStakeUIDataRaw), | ||
// // getGeneralStakeUIDataHumanized: async () => | ||
// // Promise.resolve(GeneralStakeUIDataHumanized), | ||
// // getUserStakeUIDataHumanized: async () => | ||
// // Promise.resolve(GetUserStakeUIDataHumanized), | ||
// // getAllStakedTokenData: async () => Promise.resolve(GeneralStakeUIDataRaw), | ||
// // getAllStakedTokenUserData: async () => | ||
// // Promise.resolve(GetUserStakeTotalsRaw), | ||
// } as unknown as IStakedTokenDataProvider); | ||
|
||
describe('Init', () => { | ||
it('Expects to create the instance', () => { | ||
// const instance: UiStakeDataProviderInterface = new UiStakeDataProvider({ | ||
// uiStakeDataProvider, | ||
// provider: dataProvider, | ||
// }); | ||
|
||
// expect(instance instanceof UiStakeDataProvider); | ||
expect(true); | ||
}); | ||
}); | ||
// describe('getUserStakeUIData', () => { | ||
// const instance: UiStakeDataProviderInterface = new UiStakeDataProvider({ | ||
// uiStakeDataProvider, | ||
// provider: dataProvider, | ||
// }); | ||
// it('Expects to get user raw data', async () => { | ||
// const rawData = await instance.getUserStakeUIData({ user }); | ||
// expect(rawData.stkAaveData.stakedTokenUserBalance).toEqual( | ||
// BigNumber.from(0), | ||
// ); | ||
// }); | ||
// it('Expects to fail if user not eth address', async () => { | ||
// const user = 'asdf'; | ||
// await expect(async () => | ||
// instance.getUserStakeUIData({ user }), | ||
// ).rejects.toThrowError( | ||
// new Error(`Address: ${user} is not a valid ethereum Address`), | ||
// ); | ||
// }); | ||
// }); | ||
// describe('getGeneralStakeUIData', () => { | ||
// const instance: UiStakeDataProviderInterface = new UiStakeDataProvider({ | ||
// uiStakeDataProvider, | ||
// provider: dataProvider, | ||
// }); | ||
// it('Expects to get general stake raw data', async () => { | ||
// const rawData = await instance.getGeneralStakeUIData(); | ||
// expect(rawData).toEqual(GeneralStakeUIDataRaw); | ||
// }); | ||
// }); | ||
// describe('getUserStakeUIDataHumanized', () => { | ||
// const instance: UiStakeDataProviderInterface = new UiStakeDataProvider({ | ||
// uiStakeDataProvider, | ||
// provider: dataProvider, | ||
// }); | ||
// it('Expects to get user data in a humanized format', async () => { | ||
// const rawData = await instance.getUserStakeUIDataHumanized({ user }); | ||
// expect(rawData).toEqual(GetUserStakeUIDataHumanized); | ||
// }); | ||
// it('Expects to fail if user not eth address', async () => { | ||
// const user = 'asdf'; | ||
// await expect(async () => | ||
// instance.getUserStakeUIDataHumanized({ user }), | ||
// ).rejects.toThrowError( | ||
// new Error(`Address: ${user} is not a valid ethereum Address`), | ||
// ); | ||
// }); | ||
// }); | ||
// describe('getGeneralStakeUIDataHumanized', () => { | ||
// const instance: UiStakeDataProviderInterface = new UiStakeDataProvider({ | ||
// uiStakeDataProvider, | ||
// provider: dataProvider, | ||
// }); | ||
// it('Expects to get general stake data in a humanized format', async () => { | ||
// const rawData = await instance.getGeneralStakeUIDataHumanized(); | ||
// expect(rawData).toEqual(GeneralStakeUIDataHumanized); | ||
// }); | ||
// }); | ||
}); |