fde488ac82
BREAKING CHANGE: `defineContentScript` and `defineBackground` are now exported from `wxt/sandbox` instead of `wxt/client`. If you use auto-imports, no changes are required. If you have disabled auto-imports, you'll need to manually update your import statements.
26 lines
691 B
TypeScript
26 lines
691 B
TypeScript
import { describe, expect, it, vi } from 'vitest';
|
|
import { defineBackground } from '~/sandbox/define-background';
|
|
import { BackgroundDefinition } from '~/types';
|
|
|
|
describe('defineBackground', () => {
|
|
it('should return the object definition when given an object', () => {
|
|
const definition: BackgroundDefinition = {
|
|
include: [''],
|
|
persistent: false,
|
|
main: vi.fn(),
|
|
};
|
|
|
|
const actual = defineBackground(definition);
|
|
|
|
expect(actual).toEqual(definition);
|
|
});
|
|
|
|
it('should return the object definition when given a main function', () => {
|
|
const main = vi.fn();
|
|
|
|
const actual = defineBackground(main);
|
|
|
|
expect(actual).toEqual({ main });
|
|
});
|
|
});
|