This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/models/Collection.test.js
2018-05-31 11:42:39 -07:00

33 lines
805 B
JavaScript

/* eslint-disable */
import Collection from './Collection';
const { client } = require('utils/ApiClient');
describe('Collection model', () => {
test('should initialize with data', () => {
const collection = new Collection({
id: 123,
name: 'Engineering',
});
expect(collection.name).toBe('Engineering');
});
describe('#fetch', () => {
test('should update data', async () => {
client.post = jest.fn(() => ({
data: {
name: 'New collection',
},
}))
const collection = new Collection({
id: 123,
name: 'Engineering',
});
await collection.fetch();
expect(client.post).toHaveBeenCalledWith('/collections.info', { id: 123 });
expect(collection.name).toBe('New collection');
});
});
});