Platform
Resources
Pricing
Sign in
Get started
Michael Pishchagin
Workspace
Fork
Public
By
Michael Pishchagin
Edited
Nov 10, 2023
Fork of
unittest
Importers
Insert cell
Insert cell
test
(
'Addition'
,
(
)
=>
{
expect
(
1
+
2
)
.
toBe
(
3
)
}
)
Insert cell
test
(
'Array.push() and pop()'
,
(
)
=>
{
const
array
=
[
1
,
2
,
3
]
// push
array
.
push
(
4
)
expect
(
array
)
.
toStrictEqual
(
[
1
,
2
,
3
,
4
]
)
// pop
expect
(
array
.
pop
(
)
)
.
toBe
(
4
)
expect
(
array
)
.
toStrictEqual
(
[
1
,
2
,
3
]
)
}
)
Insert cell
Insert cell
function
fixture
(
)
{
return
[
1
,
2
,
3
]
}
Insert cell
test
(
'Addition with pre-defined data'
,
(
)
=>
{
const
data
=
fixture
(
)
expect
(
data
.
reduce
(
(
a
,
b
)
=>
a
+
b
)
)
.
toBe
(
1
+
2
+
3
)
}
)
Insert cell
describe
(
"bar"
,
(
)
=>
{
test
(
"foo1"
,
(
)
=>
{
}
)
;
test
(
"foo2"
,
(
)
=>
{
expect
(
1
)
.
toBe
(
1
)
;
}
)
;
}
)
Insert cell
Insert cell
function
describe
(
title
,
f
)
{
window
.
describe_results
=
[
]
;
f
(
)
;
return
html
`<div style="color:green;" >${
title
}</div>
<span>${
window
.
describe_results
}</span>`
;
}
Insert cell
test
=
(
title
,
f
)
=>
{
f
(
)
;
const
r
=
html
`<div style="color:green;" >✓ ${
title
||
"Test passing "
}</div>`
;
if
(
window
.
describe_results
)
{
window
.
describe_results
.
push
(
r
)
;
}
return
r
;
}
Insert cell
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more
Compare fork
Fork
View
Export
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
fixture
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
Edit
Add comment
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
describe
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
test
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML
expect
Edit
Add comment
Copy import
Select
Duplicate
Copy link
Embed
Delete
JavaScript
Markdown
HTML