►
Description
In this session we try to "leave the code better than we found it" by rewriting an old Vue spec to use VTU and follow testing best practices.
Part 2: https://youtu.be/mjyBU2dD3a0
MR: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/91603
A
Oh,
so,
hey
so
we're
recording
now
and
lee
is
driving
and
we
are
converting
an
old
view
test
which
was
not
using
vutas,
utils
and
testing
component
internals.
A
We
are
rewriting
it
to
test
the
components,
template
and
interface
not
be
dependent
on
the
internals
and
to
use
view
test
details,
so
we're
going
through
the
old
test
right
now
making
sure
we're
capturing
the
test
scopes
to
make
sure
we
don't
miss
anything,
but
I'm
feeling
confident
we're
not
going
to
miss
anything
all
right.
A
A
Want
to
does
that
oh
coco
coco!
So
when
we
open
sorry,
I
skim
skipped
past
that
a
little
bit.
B
A
I
think
like
like
coming
from
most
paradigms
that
is
kind
of
what
you
would
what
unit
testing
would
be
like,
but
when
you
think
of
view
components,
methods
and
states
are
kind
of
like
they
should
have
like
a
private
keyword
in
front
of
them.
So
we
don't
test
private
methods
and
you
don't
want
anything
to
call
the
method
very
rarely
do
we
want
to
do
that,
and
there
are
some
exceptions
that
we
do
allow,
which
are
like
the
open
here
and
the
modal
and
things
like
that.
A
A
Oh,
this
is
testing
if
we
actually
create
from
a
template.
Yes,
yes,
yes,
so,
let's,
let's
add
a
to-do.
This
is
the
context
that
we
want
to
make
sure
when
using
one
of
the
template
buttons
when
we're
doing
create
from
template
button.
Oh-
and
we
want
to
add
one-
the
other
one
was
good
too
right.
We
want
to
keep
that
I've
kind
of
cheated.
A
B
A
B
Then
I
can't
find
the
control
for
my
air
conditioning
where
the
hell
is
it
going.
There
is
sorry,
it's
bacon
right,
so
so
yeah
sorry
when
using
one
of
the
template
buttons
yeah.
That's.
A
That
kind,
yeah,
okay
and
then.
A
C
That
one's
checking
the
create
flash
method
call
which
seems
reasonable
to
me.
We
could
probably
lift
that,
as
is.
A
Not
that
bad
yeah,
it's
it's
not
that
bad
to
replace
these
kind
of
things
line
189
it
does
not
throw
when
target,
and
then
I
would
do.
B
This
I'm
just
gonna
double
check.
What
because
we
did
get
a
few
hints
as
well,
so
I'm
just
gonna
say:
if
there's
anything,
okay,
so
we're
saying
store,
we
can
expect
store
dispatch
to
being
called,
is
a
good
way
to
check
that
like
when
the
file
doesn't
already
exist,
that
it
does
actually
do
what
it's
supposed
to
do
when
the
folder
doesn't
already
exist
when
the
file
that
you're
renaming,
etc
yeah
yeah,
I
so
is
that
kind
of
it
to
do
when
doesn't
exist.
A
Or
just
successful,
like
I
usually
organize
these
as
like
I'll
call
this
case
like
when
default,
which
is
like
this
is
the
happy
case.
We
do
the
happy
thing
and
then
I
have
all
my
exceptional
conditions.
A
Yeah
cool
awesome,
and
so
then
then
this
looks
like
special
behavior,
where
we
trim
white
space
from
the.
C
A
touch
you
you
can
yeah
if
well,
depending
on
which
system
a
file
can
have
any
characters
except
forward,
slash
and
null.
C
B
But
I
don't
think
quotes
is,
quotes,
valid
or
single
quotes,
double
quotes.
A
B
B
I
think
that's
quite
good,
because
copying
and
pasting
notoriously
puts
phantom
spaces
in
right,
yeah.
Well,
I
I
guess
I
mean
and
you're
just
gonna
have
to
not
use
the
web
idea
if
you
wanna
create
a
file
with
a
space
at
the
end.
A
C
C
Has
more
restrictions
you
can't
have,
I
think,
like
colon
and
semicolon
and
stuff
like
that,
yeah.
B
C
B
C
B
A
All
right
right,
where
do
we
start?
We
got
this.
So,
let's
open
up
our
test
subject
on,
let's,
let's
kill
the
right
window,
let's
open
the
test!
Subject
the
modal
that
view
there
would
be
nice.
B
A
A
There's
a
hundred
ways:
we
can
approach
this.
Let's
I
am
going
to
suggest
we
do
this.
Almost
every
single
one
of
these
is
going
to
need
this
store,
but
let's,
let's
create
our
create
component
function.
A
A
These
are
going
to
have
different
conditions.
So
let's
not
do
that
in
the
top
level
before
each,
but
we.
B
Can
gonna
cheat
and
have
a
look,
how
we
normally
do
it
elsewhere?
This
sort
of
this
sort
of
thing
I.
B
B
Yeah
because
we
don't
want,
we
don't
want
all
of
this
to
be
nested
right.
D
How
do
we
feel
about
using
the
extended
wrapper
component
or
hardware,
because
I
believe
that
we're
fans
I
yeah,
I
am
and
since
we're
speaking
about
finding
stuff
just
happening.
B
And
extended,
are
we
using
it
here?
Yes,
we
are.
A
Yeah
marks
we're
not
doing
any
toasty
marks.
A
And
can
we
move
those
lets
that
declare
our
shared
variables
would
be
at
the
top
we
can
indeed,
and
then
I
do
think
we
will
want
to
let's
initialize
the
store
at
the
very
top,
because
that's
if
we
need
to
change
the
state
or
whatever
we
can
do
that
and
then
in
our
context
easily.
So
that
way
we
don't
have
to
do.
B
We
need
before.
A
And
then
one
one
small
thing
and
you'll
see
this
and
some
of
the
other
example
code
we
have
here
when
we
want
to
create
a
spy
for
a
function
what's
happening
in
line.
18
is
a
little
inferior
to
using
spy
just
spy
on,
because
if
dispatch
doesn't
exist,
it's
we're
just
gonna
overwrite
it
and
just
create
a
we're.
Just
gonna
override
it,
no
matter
what
right
a
way
to
call
the
internal
method.
A
If
we
ever
want
to
do
that,
we
use
just
fine
it'll
blow
up
if
the
method
doesn't
already
exist,
which
is
a
good
thing
and
we
can
have
it
call
the
inner
methods
and
behave
normally
as
we'd
want
or
have
a
lot
more
control
over
it.
So,
instead
of
on
line
18,
where
we
do
dispatch
equals
just
fn,
let's
get
rid
of
that
whole
line
and
let's
do
just
dot
spy
on
store,
comma
quote:
dispatch.
A
Yeah
yeah
yeah,
that's
that's
the
money.
Beautiful
cool
props
is
gonna,
be
different.
Let's
go
up
and
see
the
props
of
our
subject
on
the
left.
Yeah.
Absolutely.
A
No
not
yet,
if
we
scroll
down
to,
we
could
probably
just
do
a
search
for
modal
type
equals
just
a
single
equal
space
space
equals
space.
Maybe.
B
C
B
A
A
What's
not
great
is
clearly,
we
will
have
to
interact
with
the
internals
for
us
to
use
this
component
yeah,
but
rather
than
us
peppering
that
all
throughout
the
test.
Let's
put
that
in
a
helper
function
with
a
to
do
basically
saying
this
is
how
this
component
expects
to
be
opened.
We
can
adjust.
Let's
address
this
and
another
thing.
So
that's
interesting.
I
was
not
expecting
that
yeah.
I
wasn't
expecting
it.
D
I
am
out
of
curiosity
about
the
code
on
the
left,
and
this
is
this
is
not
to
blame
anybody,
but
just
to
understand
just
to
understand
the
context.
Is
there
something
that
kind
of
you
evolve
to
making
this
a
bad
idea,
or
is
this
just
trying
to
force
a
paradigm
which
the
framework
does
not
really
support
into
it,
with
the
with
the
public
method
method
or
just
like
yeah,
using
rather
private
method
as
a
public
api.
C
Are
you
asking
is
the
is
the
views
intention
that
methods
on
a
component
are
private
explicitly
and
they
just
happen
to
be
available.
Well,
I
don't
know,
I
think,
there's
there's
certainly
a
paradigm
where
it's
useful,
so,
for
instance,
you
can
have
some
root
component
that
provides
its
own
instance
to
descendants
and
that's
useful
for
where
you've
got
to
have
quite
deep
connection
between
some
root
component
and
its
descendants.
C
Basically
it's
it's
that's
a
case
where
the
methods
are
used
in
a
let's
call.
It
protected
to
use
an
object-oriented
term
sense,
it's
protected
in
the
sense
that
it's
meant
to
be
used
for
components
that
are
built
to
work
together,
but
it's
not
meant
to
be
used
outside
of
that.
C
A
Have
I
think
we
have
a
preference
to
for
state
reactivity
to
drive
the
behavior
rather
than
function?
Calls
in
the
first
place
like
let's
try.
B
A
A
A
Just
I'm
changing
my
internal
data
state,
it's
really
confusing
who
owns
this
state,
and
so
we
tend
to
use
a
fence
with,
like
top
level
components
for
this
kind
of
thing,
but
I
don't
know,
I
think
we
we
tend
to
try
to
try
to
keep
things
state
driven
as
much
as
possible
and
not
these
method
calls
because
they're
there's
there
can
be
dragons
here.
B
So,
what's
it
going
to
look
like,
is
it
going
to
be
a
sort
of
we're
going
to
pass
it
something?
And
it's
going
to
be
a
what
says
that
that
yeah.
A
So,
let's
have
it
pass
in
the
type
and
the
path-
I
guess
yeah.
So
it's
just
a
little
nice
adapter
for
this
internal
method,
yeah.
C
B
C
B
And
then
we
are
just
passing
type
and
path.
Only
rapper
vm
is
my
street
name.
B
A
C
I
was
gonna
say
we're
passing
in
the
store
we
probably
well.
We
definitely
will
want
to
recreate
the
store
for
each
test,
just
like
we
will
recreate
the
component.
A
A
Well,
I
don't
know
if
we
need
a
factory
method
for
it
because
creating
a
store
we
can
change.
We
can
just
manually
change
the
state
of
it
before
we
create
the
component.
You
know.
A
A
B
Big
question
I'm
sure,
but
could
we
would
it
make
any?
I
I
don't
know
how
many
things
we've
got
to
do,
but
I
think
this
might
have
been
what
mark
was
saying
a
moment
ago
that
we
could
pass
it
like
find
out
what
things
we
actually
need
to.
How
many
variables
are
there
in
the
state
that
we
actually
need
to
work
with?
B
A
B
B
But
another
part
of
me:
I
guess
if,
if
we
want
to
simplify
so
you
can
access
any
property
of
the
store
or
the
wrapper
or
whatever
it
might
be.
Yeah.
Okay!
So
we'll
leave
that
out
for
the
moment
so,
and
we
also
because
you
know.
A
We're
talking
this
high
level,
like
we
kind
of
don't
need
our
mount
component
function,
because
we
don't
have
any
props.
It's
all
just
about
the
open,
we're
never
going
to
have
a
different
context.
A
A
A
But
at
the
time
we
create
it,
we
might
need
to
adjust
the
store
first
and
that's.
What
I
think
mark
is
saying
is
we
could
have
that
in
a
function
or
not
or
we
could
just
manually
do
the
store.
So
we
do.
We
don't
want
to
do
this
in
the
top
level
before
each
I.
I
am
actually
pretty
certain
of
that.
I
was
thinking
we
could,
but
no,
let's
not
do
that.
Let's
keep
it
like
this.
A
Let's
keep
moving
forward
and
we'll
reshuffle
things
if
we
need
to
there's
simpler
ways
of
doing
it,
yeah
on
line
20,
I
think
we're
overwriting
a
create
store
helper
that
we're
already
using
oh.
A
But
if
we
need,
if
we
need
to
create
store
factory
function,
we'll
we'll
we'll
we'll
add
it,
I'm
not
sure
well,
but
we
might
on
the
after
each
you're
totally
right.
We
want
to
do
store
null.
We
also
want
to
do
rapper.destroy
on
the
after
each.
A
Awesome
cool,
I
think,
we're
ready
to
start
testing
it,
let's
create.
Let's
describe,
I
always
like
to
create
a
default
describe
where
I
say
just
default.
This
is
the
happy
path
case
and
when
I
haven't
done
anything
with
it,
what's
the
kind
of
state
I
expect
it
to
be
in.
A
A
Do
show
well,
that's
not
necessarily
rendering
it
that's
just
changing
the
state
of
the
children,
the
child
model,
so
I
think
I
think,
having
a
renders
modal
is
nice
and
we
can
just
find
the
modal
and
assert
on
it.
A
A
Yeah!
Sorry,.
A
It
is
fine
component
gl
modal
yeah
and
then
let's
assert
the
props.
So
let's
do.
A
B
A
A
B
A
C
A
C
Can
I
suggest
you
set
up
a
watch
rather
than
running
the
the
test
suite
manually
just
so
it's
the
same.
B
Excuse
me,
sorry,
how
are
you
guys
pressed
for
time.
A
I
actually
have
a
meeting,
but
that's
just
me
your
system
limit
for
number
of
firewall
watchers
reached.
So
this
is
a
linux
pain
in
the
ass
right.
B
C
B
C
B
B
A
We're
getting
close
so
I
do
have
to
hop
off
I'll
be
available
in
an
hour
to
hop
back
on
lee
if
you
want
to
and
if
anyone
else
wants
to,
but
yeah
I
mean.
B
Maybe
I'll
hop
off
because
my
team
might
be
needing
me
anyway
and
then
we'll
see
how
we're
doing
in
an
hour
or
so
cool
sounds
good
or
yannick.
If
anyone
knows
the
answer
to
this
one,
then
you
could
help
me
quickly,
but
I
would
probably
just
google
it
and
I
imagine
I'll,
find
the
answer
quite
quickly.
D
That's
it
if
anybody
has
someone
when
it's
whispering
actually
be
coming
up
with
a
small
question,
but
everybody
who
needs
to
hop
off
now,
please,
please
do
so.
Don't
feel
obligated
to
well.