Skip to content

Commit

Permalink
Up asset model tests
Browse files Browse the repository at this point in the history
  • Loading branch information
artf committed Sep 1, 2023
1 parent 18063bb commit e726729
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 37 deletions.
29 changes: 0 additions & 29 deletions test/specs/asset_manager/model/Asset.js

This file was deleted.

29 changes: 29 additions & 0 deletions test/specs/asset_manager/model/Asset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Asset from '../../../../src/asset_manager/model/Asset';

describe('Asset', () => {
test('Object exists', () => {
expect(Asset).toBeTruthy();
});

test('Has default values', () => {
const asset = new Asset({});
expect(asset.get('type')).toBeFalsy();
expect(asset.get('src')).toBeFalsy();
expect(asset.getExtension()).toBeFalsy();
expect(asset.getFilename()).toBeFalsy();
});

test('Test getFilename', () => {
const asset = new Asset({ type: 'image', src: 'ch/eck/t.e.s.t' });
expect(asset.getFilename()).toEqual('t.e.s.t');
const asset2 = new Asset({ type: 'image', src: 'ch/eck/1234abc' });
expect(asset2.getFilename()).toEqual('1234abc');
});

test('Test getExtension', () => {
const asset = new Asset({ type: 'image', src: 'ch/eck/t.e.s.t' });
expect(asset.getExtension()).toEqual('t');
const asset2 = new Asset({ type: 'image', src: 'ch/eck/1234abc.' });
expect(asset2.getExtension()).toEqual('');
});
});
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import AssetImage from 'asset_manager/model/AssetImage';
import AssetImage from '../../../../src/asset_manager/model/AssetImage';

describe('AssetImage', () => {
test('Object exists', () => {
expect(AssetImage).toBeTruthy();
});

test('Has default values', () => {
var obj = new AssetImage({});
const obj = new AssetImage({});
expect(obj.get('type')).toEqual('image');
expect(obj.get('src')).toBeFalsy();
expect(obj.get('unitDim')).toEqual('px');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import Assets from 'asset_manager/model/Assets';
import Assets from '../../../../src/asset_manager/model/Assets';

describe('Assets', () => {
var obj;
let obj: Assets;

beforeEach(() => {
obj = new Assets();
});

afterEach(() => {
obj = null;
});

test('Object exists', () => {
expect(obj).toBeTruthy();
});
Expand Down

0 comments on commit e726729

Please sign in to comment.