-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pre migration refactor | unit tests (#59)
* take into account interlude period * tests setup * more tests * fix build * fix ci * fi ci * clean up interlacing * util tests * lint fixes * disable market for now
- Loading branch information
Showing
13 changed files
with
341 additions
and
57 deletions.
There are no files selected for viewing
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,7 @@ | ||
{ | ||
"presets": [ | ||
"@babel/preset-env", | ||
"@babel/preset-typescript", | ||
"next/babel" | ||
] | ||
} |
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
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,13 @@ | ||
module.exports = { | ||
transform: { | ||
'^.+\\.(ts|tsx)$': 'ts-jest', | ||
'^.+\\.(js|jsx)$': 'babel-jest', | ||
}, | ||
moduleNameMapper: { | ||
// If you're using absolute imports or path aliases, set them up here | ||
}, | ||
testEnvironment: 'jsdom', // or "node", depending on your project needs | ||
moduleNameMapper: { | ||
'^@/(.*)$': '<rootDir>/src/$1', // Ensure this matches the structure defined in tsconfig.json | ||
}, | ||
}; |
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
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
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
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
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
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,41 @@ | ||
import { CoreMask, RegionId } from 'coretime-utils'; | ||
|
||
import { | ||
extractRegionIdFromRaw, | ||
parseHNString, | ||
parseHNStringToString, | ||
} from './functions'; | ||
|
||
describe('Util functions', () => { | ||
describe('parseHNString', () => { | ||
it('works', () => { | ||
const a = '100,305'; | ||
expect(parseHNString(a)).toBe(100305); | ||
const b = '42'; | ||
expect(parseHNString(b)).toBe(42); | ||
expect(parseHNString('')).toBe(NaN); | ||
}); | ||
}); | ||
|
||
describe('parseHNStringToString', () => { | ||
it('works', () => { | ||
const a = '100,305'; | ||
expect(parseHNStringToString(a)).toBe('100305'); | ||
const b = '42'; | ||
expect(parseHNStringToString(b)).toBe('42'); | ||
expect(parseHNStringToString('')).toBe(''); | ||
}); | ||
}); | ||
|
||
describe('extractRegionIdFromRaw', () => { | ||
it('works', () => { | ||
const raw = '316913858982876965003350507519'; | ||
const regionId: RegionId = { | ||
begin: 4, | ||
core: 0, | ||
mask: CoreMask.completeMask(), | ||
}; | ||
expect(extractRegionIdFromRaw(BigInt(raw))).toStrictEqual(regionId); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.