UNPKG

1.33 kBJavaScriptView Raw
1// @flow strict-local
2
3import assert from 'assert';
4import {Bundle, NamedBundle} from '../src/public/Bundle';
5import BundleGraph from '../src/BundleGraph';
6import {createEnvironment} from '../src/Environment';
7import {DEFAULT_OPTIONS} from './utils';
8import Graph from '../src/Graph';
9
10describe('Public Bundle', () => {
11 let internalBundle;
12 let bundleGraph;
13 beforeEach(() => {
14 let env = createEnvironment({});
15 internalBundle = {
16 id: '123',
17 entryAssetIds: [],
18 type: 'js',
19 env,
20 filePath: null,
21 name: null,
22 pipeline: null,
23 isEntry: null,
24 isInline: null,
25 isSplittable: true,
26 target: {
27 env,
28 distDir: '',
29 name: '',
30 publicUrl: '',
31 },
32 stats: {size: 0, time: 0},
33 };
34
35 bundleGraph = new BundleGraph({graph: new Graph()});
36 });
37
38 it('returns the same public Bundle given an internal bundle', () => {
39 assert.equal(
40 new Bundle(internalBundle, bundleGraph, DEFAULT_OPTIONS),
41 new Bundle(internalBundle, bundleGraph, DEFAULT_OPTIONS),
42 );
43 });
44
45 it('returns the same public NamedBundle given an internal bundle', () => {
46 assert.equal(
47 new NamedBundle(internalBundle, bundleGraph, DEFAULT_OPTIONS),
48 new NamedBundle(internalBundle, bundleGraph, DEFAULT_OPTIONS),
49 );
50 });
51});