UNPKG

@intocode-io/fireliff-cli

Version:

Command line interface for building LIFF app on Firebase

33 lines (27 loc) 882 B
import Axios from 'axios'; import { RichMenuRequest } from '../lib/rich-menu-request'; describe('RichMenuRequest', () => { describe('when create instance with options.accessToken', () => { let req; let accessToken = 'someaccesstoken'; beforeAll(() => { jest.spyOn(Axios, 'create'); req = new RichMenuRequest({ accessToken }); }); it('should have correct endpoint', () => { expect(req.endpoint).toEqual('https://api.line.me/v2/bot/richmenu'); }); it('should create axios instance with correct headers for LINE API', () => { expect(Axios.create).toHaveBeenCalledWith({ headers: { authorization: `Bearer ${accessToken}`, 'content-type': 'application/json', }, }); expect(req.axios).toBeDefined(); }); afterAll(() => { Axios.create.mockRestore(); }); }); });