spec/client/models/asset.spec.js in hippo-fw-0.9.1 vs spec/client/models/asset.spec.js in hippo-fw-0.9.2
- old
+ new
@@ -21,30 +21,19 @@
it('can use json', () => {
const image = TestImage.deserialize({ asset: LogoJson });
expect(image.asset.isImage).toBe(true);
expect(image.asset.previewUrl)
- .toEqual(`/api/asset/${LogoJson.file_data.thumbnail.id}`);
+ .toContain(LogoJson.file_data.thumbnail.id);
expect(image.asset.owner).toBe(image);
expect(image.asset.owner_association_name).toBe('asset');
});
it('can be saved', () => {
model.asset.file = file;
expect(model.asset.isDirty).toBe(true);
model.asset.save();
- expect(fetch).lastCalledWith('/api/asset', expect.objectContaining({
+ expect(fetch).lastCalledWith(expect.anything(), expect.objectContaining({
body: expect.any(FormData),
}));
- });
-
- it('attempts to save after owner does', () => {
- model.asset.save = jest.fn();
- expect(model.asset.isDirty).toBe(false);
- model.save();
- expect(model.asset.save).not.toHaveBeenCalled();
- model.asset.file = file;
- expect(model.asset.isDirty).toBe(true);
- model.save();
- expect(model.asset.save).toHaveBeenCalled();
});
});