Skip to content

Commit ad3b458

Browse files
committed
Add failing test for samualtnorman#256
1 parent 698970b commit ad3b458

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export default ({ expect }: typeof import('vitest')) => {
2+
const myObject = {
3+
a: 0,
4+
b: function () {
5+
this.a++
6+
return this.a
7+
},
8+
c: function (value: number = this.a) {
9+
this.a = value + 1
10+
},
11+
d: function ({ value = this.a }: { value?: number }) {
12+
this.a = value + 1
13+
}
14+
}
15+
16+
expect(myObject.a).toBe(0)
17+
myObject.b()
18+
expect(myObject.a).toBe(1)
19+
myObject.c()
20+
expect(myObject.a).toBe(2)
21+
myObject.d({})
22+
expect(myObject.a).toBe(3)
23+
}

0 commit comments

Comments
 (0)