Skip to content

Commit

Permalink
fix: bifrost type issue & small fixes in tests (#1345)
Browse files Browse the repository at this point in the history
- Add check in sanitize numbers for Bifrost object type
- Add `isEthereum` entry in test results
- Small fix in jest config
  • Loading branch information
Imod7 authored Oct 27, 2023
1 parent 8fa49aa commit 567170b
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "2",
"tokenDecimals": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "2",
"tokenDecimals": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "2",
"tokenDecimals": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "2",
"tokenDecimals": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "2",
"tokenDecimals": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "0",
"tokenDecimals": [
"10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "0",
"tokenDecimals": [
"10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "0",
"tokenDecimals": [
"10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "0",
"tokenDecimals": [
"10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "42",
"tokenDecimals": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "42",
"tokenDecimals": [
"12"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"live": null
},
"properties": {
"isEthereum": false,
"ss58Format": "42",
"tokenDecimals": [
"12"
Expand Down
15 changes: 10 additions & 5 deletions e2e-tests/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ module.exports = {
testEnvironment: 'node',
maxConcurrency: 3,
maxWorkers: '50%',
globals: {
'ts-jest': {
isloatedModules: true
}
}
transform: {
// '^.+\\.[tj]sx?$' to process js/ts with `ts-jest`
// '^.+\\.m?[tj]sx?$' to process js/ts/mjs/mts with `ts-jest`
'^.+\\.tsx?$': [
'ts-jest',
{
isolatedModules: true
},
],
},
};
5 changes: 4 additions & 1 deletion src/sanitize/sanitizeNumbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ function mapTypeSanitizeKeyValue(
const jsonMap: AnyJson = {};

map.forEach((value: unknown, key: unknown) => {
const nonCodecKey = sanitizeNumbers(key, options);
let nonCodecKey = sanitizeNumbers(key, options);
if (typeof nonCodecKey === 'object') {
nonCodecKey = JSON.stringify(nonCodecKey);
}
if (!(typeof nonCodecKey === 'string' || typeof nonCodecKey === 'number')) {
throw new InternalServerError(
'Unexpected non-string and non-number key while sanitizing a Map-like type'
Expand Down

0 comments on commit 567170b

Please sign in to comment.