UNPKG

@intocode-io/fireliff-cli

Version:

Command line interface for building LIFF app on Firebase

33 lines (27 loc) 867 B
import Axios from 'axios'; import { ThingsRequest } from '../lib/things-request'; describe('ThingsRequest', () => { describe('when create instance with options.accessToken', () => { let req; let accessToken = 'someaccesstoken'; beforeAll(() => { jest.spyOn(Axios, 'create'); req = new ThingsRequest({ accessToken }); }); it('should have correct endpoint', () => { expect(req.endpoint).toEqual('https://api.line.me/things/v1'); }); 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(); }); }); });