Skip to content

Commit

Permalink
test: add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 12, 2022
1 parent cc231ba commit fb13e7a
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/core/test/execution-order.test.ts
@@ -0,0 +1,49 @@
import { describe, expect, it } from 'vitest'

let v = 0

function bumpSync() {
v += 1
}

function bump() {
return new Promise<void>((resolve) => {
setTimeout(() => {
v += 1
resolve()
}, 1)
})
}

it('one', () => {
bumpSync()
expect(v).toBe(1)
})

it('two', async() => {
expect(v).toBe(1)
await bump()
expect(v).toBe(2)
})

describe('suite', () => {
it('three', () => {
bumpSync()
expect(v).toBe(3)
})

it('four', async() => {
expect(v).toBe(3)
await bump()
expect(v).toBe(4)
})

it('four', () => {
expect(v).toBe(4)
})

it('five', () => {
bumpSync()
expect(v).toBe(5)
})
})

0 comments on commit fb13e7a

Please sign in to comment.