UNPKG

807 BJavaScriptView Raw
1import { assert } from 'chai';
2
3import { initialHashFn } from '../src/exports';
4
5describe('initialHashFn()', () => {
6 it('does not minify in development', () => {
7 const hashFn = initialHashFn();
8 const key = 'key';
9
10 const result = hashFn('test', key);
11 assert.isOk(result.startsWith(`${key}_`));
12 });
13
14 describe('process.env.NODE_ENV === \'production\'', () => {
15 beforeEach(() => {
16 process.env.NODE_ENV = 'production';
17 });
18
19 afterEach(() => {
20 delete process.env.NODE_ENV;
21 });
22
23 it('minifies', () => {
24 const hashFn = initialHashFn();
25 const key = 'key';
26
27 const result = hashFn('test', key);
28 assert.isNotOk(result.startsWith(`${key}_`));
29 });
30 })
31});