UNPKG

958 BJavaScriptView Raw
1// @flow strict-local
2
3import assert from 'assert';
4import {Asset, MutableAsset} from '../src/public/Asset';
5import InternalAsset, {createAsset} from '../src/InternalAsset';
6import {createEnvironment} from '../src/Environment';
7import {DEFAULT_OPTIONS} from './utils';
8
9describe('Public Asset', () => {
10 let internalAsset;
11 beforeEach(() => {
12 internalAsset = new InternalAsset({
13 options: DEFAULT_OPTIONS,
14 value: createAsset({
15 filePath: '/does/not/exist',
16 type: 'js',
17 env: createEnvironment({}),
18 isSource: true,
19 stats: {size: 0, time: 0},
20 }),
21 });
22 });
23
24 it('returns the same public Asset given an internal asset', () => {
25 assert.equal(new Asset(internalAsset), new Asset(internalAsset));
26 });
27
28 it('returns the same public MutableAsset given an internal asset', () => {
29 assert.equal(
30 new MutableAsset(internalAsset),
31 new MutableAsset(internalAsset),
32 );
33 });
34});