mirror of
https://github.com/hanzoai/vitest.git
synced 2026-09-24 17:04:25 +00:00
27 lines
585 B
TypeScript
27 lines
585 B
TypeScript
import { expect, test } from 'vitest'
|
|
|
|
expect.addSnapshotSerializer({
|
|
test(value) {
|
|
return value && typeof value === 'object' && '__unwrap__' in value
|
|
},
|
|
serialize(value) {
|
|
return value.__unwrap__
|
|
},
|
|
})
|
|
|
|
test('file empty', () => {
|
|
expect({ __unwrap__: "" }).toMatchSnapshot()
|
|
})
|
|
|
|
test('inline empty', () => {
|
|
expect({ __unwrap__: "" }).toMatchInlineSnapshot(``)
|
|
})
|
|
|
|
test('file whitespaces', () => {
|
|
expect({ __unwrap__: " ".repeat(4) }).toMatchSnapshot()
|
|
})
|
|
|
|
test('inline whitespaces', () => {
|
|
expect({ __unwrap__: " ".repeat(4) }).toMatchInlineSnapshot(``)
|
|
})
|