Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
6625b037
Unverified
Commit
6625b037
authored
Apr 10, 2023
by
OptimismBot
Committed by
GitHub
Apr 10, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5382 from ethereum-optimism/sc/core-test-folder-structure
maint(core): clean up test folder structure
parents
5b7d62a7
0a4b1115
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
17 deletions
+25
-17
package.json
packages/core-utils/package.json
+2
-2
hex-strings.spec.ts
packages/core-utils/test/common/hex-strings.spec.ts
+4
-2
misc.spec.ts
packages/core-utils/test/common/misc.spec.ts
+4
-4
test-utils.spec.ts
packages/core-utils/test/common/test-utils.spec.ts
+7
-2
alias.spec.ts
packages/core-utils/test/optimism/alias.spec.ts
+2
-2
batch-encoding.spec.ts
packages/core-utils/test/optimism/batch-encoding.spec.ts
+4
-3
fees.spec.ts
packages/core-utils/test/optimism/fees.spec.ts
+2
-2
No files found.
packages/core-utils/package.json
View file @
6625b037
...
...
@@ -15,8 +15,8 @@
"lint:check"
:
"eslint . --max-warnings=0"
,
"lint:fix"
:
"yarn lint:check --fix"
,
"pre-commit"
:
"lint-staged"
,
"test"
:
"ts-mocha test/*.spec.ts"
,
"test:coverage"
:
"nyc ts-mocha test/*.spec.ts && nyc merge .nyc_output coverage.json"
"test"
:
"ts-mocha test/*
*/*
.spec.ts"
,
"test:coverage"
:
"nyc ts-mocha test/*
*/*
.spec.ts && nyc merge .nyc_output coverage.json"
},
"keywords"
:
[
"optimism"
,
...
...
packages/core-utils/test/
hex-util
s.spec.ts
→
packages/core-utils/test/
common/hex-string
s.spec.ts
View file @
6625b037
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
/* Imports: Internal */
import
{
expect
}
from
'
./setup
'
import
{
expect
}
from
'
.
.
/setup
'
import
{
toRpcHexString
,
remove0x
,
...
...
@@ -12,7 +12,7 @@ import {
encodeHex
,
hexStringEquals
,
bytes32ify
,
}
from
'
../src
'
}
from
'
../
../
src
'
describe
(
'
remove0x
'
,
()
=>
{
it
(
'
should return undefined
'
,
()
=>
{
...
...
@@ -62,6 +62,7 @@ describe('toHexString', () => {
'
The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received null
'
)
})
it
(
'
should return with a hex string
'
,
()
=>
{
const
cases
=
[
{
input
:
0
,
output
:
'
0x00
'
},
...
...
@@ -104,6 +105,7 @@ describe('padHexString', () => {
expect
(
padHexString
(
'
abcd
'
,
1
)).
to
.
deep
.
equal
(
'
abcd
'
)
expect
(
padHexString
(
'
abcdefgh
'
,
3
).
length
).
to
.
deep
.
equal
(
8
)
})
it
(
'
should return a string padded with 0x and zeros
'
,
()
=>
{
expect
(
padHexString
(
'
0xabcd
'
,
3
)).
to
.
deep
.
equal
(
'
0x00abcd
'
)
})
...
...
packages/core-utils/test/misc.spec.ts
→
packages/core-utils/test/
common/
misc.spec.ts
View file @
6625b037
/* Imports: Internal */
import
{
expect
}
from
'
./setup
'
import
{
sleep
,
clone
,
reqenv
,
getenv
}
from
'
../src
'
import
{
expect
}
from
'
.
.
/setup
'
import
{
sleep
,
clone
,
reqenv
,
getenv
}
from
'
../
../
src
'
describe
(
'
sleep
'
,
async
()
=>
{
it
(
'
should return wait input amount of ms
'
,
async
()
=>
{
...
...
@@ -21,7 +21,7 @@ describe('clone', async () => {
})
describe
(
'
reqenv
'
,
async
()
=>
{
let
cachedEnvironment
let
cachedEnvironment
:
NodeJS
.
ProcessEnv
const
temporaryEnvironmentKey
=
'
testVariable
'
const
temporaryEnvironment
=
{
[
temporaryEnvironmentKey
]:
'
This is an environment variable
'
,
...
...
@@ -51,7 +51,7 @@ describe('reqenv', async () => {
})
describe
(
'
getenv
'
,
async
()
=>
{
let
cachedEnvironment
let
cachedEnvironment
:
NodeJS
.
ProcessEnv
const
temporaryEnvironmentKey
=
'
testVariable
'
const
temporaryEnvironment
=
{
[
temporaryEnvironmentKey
]:
'
This is an environment variable
'
,
...
...
packages/core-utils/test/test-utils.spec.ts
→
packages/core-utils/test/
common/
test-utils.spec.ts
View file @
6625b037
import
{
assert
}
from
'
chai
'
/* Imports: Internal */
import
{
expect
}
from
'
./setup
'
import
{
expectApprox
,
awaitCondition
}
from
'
../src
'
import
{
expect
}
from
'
.
.
/setup
'
import
{
expectApprox
,
awaitCondition
}
from
'
../
../
src
'
describe
(
'
awaitCondition
'
,
()
=>
{
it
(
'
should try the condition fn until it returns true
'
,
async
()
=>
{
...
...
@@ -42,6 +42,7 @@ describe('expectApprox', () => {
absoluteLowerDeviation
:
20
,
})
})
it
(
'
should pass when the actual number is lower, but within the expected range of the target
'
,
async
()
=>
{
expectApprox
(
81
,
100
,
{
percentUpperDeviation
:
20
,
...
...
@@ -50,6 +51,7 @@ describe('expectApprox', () => {
absoluteLowerDeviation
:
20
,
})
})
it
(
'
should throw an error when no deviation values are given
'
,
async
()
=>
{
try
{
expectApprox
(
101
,
100
,
{})
...
...
@@ -75,6 +77,7 @@ describe('expectApprox', () => {
)
}
})
it
(
'
... and absoluteUpperDeviation sets the upper bound
'
,
async
()
=>
{
try
{
expectApprox
(
121
,
100
,
{
...
...
@@ -88,6 +91,7 @@ describe('expectApprox', () => {
}
})
})
describe
(
'
... when both values are defined
'
,
()
=>
{
it
(
'
... and percentUpperDeviation sets the upper bound
'
,
async
()
=>
{
try
{
...
...
@@ -102,6 +106,7 @@ describe('expectApprox', () => {
)
}
})
it
(
'
... and absoluteUpperDeviation sets the upper bound
'
,
async
()
=>
{
try
{
expectApprox
(
121
,
100
,
{
...
...
packages/core-utils/test/alias.spec.ts
→
packages/core-utils/test/
optimism/
alias.spec.ts
View file @
6625b037
import
{
expect
}
from
'
./setup
'
import
{
applyL1ToL2Alias
,
undoL1ToL2Alias
}
from
'
../src
'
import
{
expect
}
from
'
.
.
/setup
'
import
{
applyL1ToL2Alias
,
undoL1ToL2Alias
}
from
'
../
../
src
'
describe
(
'
address aliasing utils
'
,
()
=>
{
describe
(
'
applyL1ToL2Alias
'
,
()
=>
{
...
...
packages/core-utils/test/
batch-encoder
.spec.ts
→
packages/core-utils/test/
optimism/batch-encoding
.spec.ts
View file @
6625b037
import
'
./setup
'
import
'
.
.
/setup
'
/* Internal Imports */
import
{
expect
}
from
'
chai
'
...
...
@@ -9,13 +9,13 @@ import {
sequencerBatch
,
BatchType
,
SequencerBatch
,
}
from
'
../src
'
}
from
'
../
../
src
'
describe
(
'
BatchEncoder
'
,
function
()
{
this
.
timeout
(
10
_000
)
// eslint-disable-next-line @typescript-eslint/no-var-requires
const
data
=
require
(
'
./fixtures/calldata.json
'
)
const
data
=
require
(
'
.
.
/fixtures/calldata.json
'
)
describe
(
'
appendSequencerBatch
'
,
()
=>
{
it
(
'
legacy: should work with the simple case
'
,
()
=>
{
...
...
@@ -112,6 +112,7 @@ describe('BatchEncoder', function () {
],
transactions
:
[
'
0x454234000000112
'
,
'
0x45423400000012
'
],
}
expect
(()
=>
encodeAppendSequencerBatch
(
batch
)).
to
.
throw
(
'
Unexpected uneven hex string value!
'
)
...
...
packages/core-utils/test/fees.spec.ts
→
packages/core-utils/test/
optimism/
fees.spec.ts
View file @
6625b037
import
'
./setup
'
import
'
.
.
/setup
'
import
{
BigNumber
}
from
'
@ethersproject/bignumber
'
import
{
zeroesAndOnes
,
calldataCost
}
from
'
../src
'
import
{
zeroesAndOnes
,
calldataCost
}
from
'
../
../
src
'
describe
(
'
Fees
'
,
()
=>
{
it
(
'
should count zeros and ones
'
,
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment