An Vim snippet library for Jest. This library uses ES6 syntax.
Based on Atom Jest Snippets.
Add this line to your .vimrc file
Plugin 'joaohkfaria/vim-jest-snippets'
expect(value)
expect($1)$2;
expect(value).toBe(value)
expect($1).toBe($2);
expect(mockFn).toHaveBeenCalled()
expect($1).toHaveBeenCalled();
expect(mockFn).toHaveBeenCalledTimes(number)
expect($1).toHaveBeenCalledTimes($2);
expect(mockFn).toHaveBeenCalledWith(arg1, arg2, ...)
expect($1).toHaveBeenCalledWith($2);
expect(number).toBeCloseTo(number, numDigits)
expect($1).toBeCloseTo($2, $3);
expect(value).toBeDefined()
expect($1).toBeDefined();
expect(value).toBeFalsy()
expect($1).toBeFalsy();
expect(number).toBeGreaterThan(number)
expect($1).toBeGreaterThan($2);
expect(number).toBeGreaterThanOrEqual(number)
expect($1).toBeGreaterThanOrEqual($2);
expect(number).toBeLessThan(number)
expect($1).toBeLessThan($2);
expect(number).toBeLessThanOrEqual(number)
expect($1).toBeLessThanOrEqual($2);
expect(obj).toBeInstanceOf(Class)
expect($1).toBeInstanceOf($2);
expect(value).toBeNull()
expect($1).toBeNull();
expect(value).toBeTruthy()
expect($1).toBeTruthy();
expect(value).toBeUndefined()
expect($1).toBeUndefined();
expect(list).toContain(value)
expect($1).toContain($2);
expect(list).toContainEqual(value)
expect($1).toContainEqual($2);
expect(value).toEqual(value)
expect($1).toEqual($2);
expect(list).toHaveLength(number)
expect($1).toHaveLength($2);
expect(string).toMatch(regexpOrString)
expect($1).toMatch($2);
expect(obj).toMatchObject(obj)
expect($1).toMatchObject($2);
expect(value).toMatchSnapshot(optionalString)
expect($1).toMatchSnapshot($2);
expect(func).toThrow(error)
expect($1).toThrow($2);
describe(name, fn)
describe('$1', () => {
$2
});
test(name, fn)
test('$1', () => {
$2
});
alias for test()
it('$1', () => {
$2
});
afterAll(fn)
afterAll(() => {
$1
})
afterEach(fn)
afterEach(() => {
$1
})
beforeAll(fn)
beforeAll(() => {
$1
})
beforeEach(fn)
beforeEach(() => {
$1
})
jest.clearAllTimers();
jest.disableAutomock();
jest.enableAutomock();
jest.fn($1);
jest.isMockFunction($1);
jest.genMockFromModule($1);
jest.mock($1);
jest.resetAllMocks();
jest.resetModules();
jest.runAllTicks();
jest.runAllTimers();
jest.runOnlyPendingTimers();
jest.setMock($1);
jest.unmock($1);
jest.useFakeTimers($1);
jest.useRealTimers($1);
.mockClear();
.mockReset();
.mockImplementation($1);
.mockImplementationOnce($1);
.mockReturnThis();
.mockReturnValue($1);
.mockReturnValueOnce($1);