Skip to content

Commit

Permalink
fix: Make getTests() stateless
Browse files Browse the repository at this point in the history
  • Loading branch information
mrousavy committed Sep 16, 2024
1 parent e9724df commit d7a9a32
Showing 1 changed file with 41 additions and 11 deletions.
52 changes: 41 additions & 11 deletions example/src/getTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,31 +128,43 @@ export function getTests(
it(() => (testObject.numberValue = 13)).didNotThrow()
),
createTest('get numberValue (== 13)', () =>
it(() => testObject.numberValue)
it(() => {
testObject.numberValue = 14
return testObject.numberValue
})
.didNotThrow()
.equals(13)
.equals(14)
),
createTest('set boolValue to true', () =>
it(() => (testObject.boolValue = true)).didNotThrow()
),
createTest('get boolValue (== true)', () =>
it(() => testObject.boolValue)
it(() => {
testObject.boolValue = true
return testObject.boolValue
})
.didNotThrow()
.equals(true)
),
createTest("set stringValue to 'hello!'", () =>
it(() => (testObject.stringValue = 'hello!')).didNotThrow()
),
createTest("get stringValue (== 'hello!')", () =>
it(() => testObject.stringValue)
it(() => {
testObject.stringValue = 'hello!'
return testObject.stringValue
})
.didNotThrow()
.equals('hello!')
),
createTest('set bigintValue to 7362572367826385n', () =>
it(() => (testObject.bigintValue = 7362572367826385n)).didNotThrow()
),
createTest('get bigintValue (== 7362572367826385n)', () =>
it(() => testObject.bigintValue)
it(() => {
testObject.bigintValue = 7362572367826385n
return testObject.bigintValue
})
.didNotThrow()
.equals(7362572367826385n)
),
Expand All @@ -163,7 +175,10 @@ export function getTests(
}).didNotThrow()
),
createTest('get stringOrUndefined (== undefined)', () =>
it(() => testObject.stringOrUndefined)
it(() => {
testObject.stringOrUndefined = undefined
return testObject.stringOrUndefined
})
.didNotThrow()
.equals(undefined)
),
Expand All @@ -174,7 +189,10 @@ export function getTests(
}).didNotThrow()
),
createTest('get stringOrNull (== undefined)', () =>
it(() => testObject.stringOrNull)
it(() => {
testObject.stringOrNull = null
return testObject.stringOrNull
})
.didNotThrow()
.equals(null)
),
Expand All @@ -185,7 +203,10 @@ export function getTests(
}).didNotThrow()
),
createTest('get optionalString (== undefined)', () =>
it(() => testObject.optionalString)
it(() => {
testObject.optionalString = undefined
return testObject.optionalString
})
.didNotThrow()
.equals(undefined)
),
Expand Down Expand Up @@ -294,13 +315,19 @@ export function getTests(
it(() => (testObject.someVariant = 55)).didNotThrow()
),
createTest('get someVariant (== 55)', () =>
it(() => testObject.someVariant).equals(55)
it(() => {
testObject.someVariant = 55
return testObject.someVariant
}).equals(55)
),
createTest("set someVariant to 'some-string'", () =>
it(() => (testObject.someVariant = 'some-string')).didNotThrow()
),
createTest("get someVariant (== 'some-string')", () =>
it(() => testObject.someVariant).equals('some-string')
it(() => {
testObject.someVariant = 'some-string'
return testObject.someVariant
}).equals('some-string')
),
createTest('set someVariant to false', () =>
it(
Expand Down Expand Up @@ -445,7 +472,10 @@ export function getTests(
it(() => (testObject.someTuple = [55, 'hello'])).didNotThrow()
),
createTest("get someTuple (== [55, 'hello'])", () =>
it(() => testObject.someTuple).equals([55, 'hello'])
it(() => {
testObject.someTuple = [55, 'hello']
return testObject.someTuple
}).equals([55, 'hello'])
),
createTest('flip([10, 20, 30])', () =>
it(() => testObject.flip([10, 20, 30]))
Expand Down

0 comments on commit d7a9a32

Please sign in to comment.