Skip to content

Commit

Permalink
test: update import path
Browse files Browse the repository at this point in the history
  • Loading branch information
chouchouji committed Oct 28, 2024
1 parent 50ec701 commit 34cc499
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion tests/array.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
shuffle,
sum,
sumBy,
} from '../src/array'
} from '../src'

it('uniq', () => {
const arr = uniq([1, 2, 2, 3, 4, 4])
Expand Down
44 changes: 22 additions & 22 deletions tests/file.spec.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { toDataURL, toText, toArrayBuffer } from '../src/file';
import { describe, it, expect, beforeEach } from 'vitest'
import { toDataURL, toText, toArrayBuffer } from '../src'

describe('file', () => {
let file: File;
let file: File

beforeEach(() => {
const blob = new Blob(['Hello, World!'], { type: 'text/plain' });
file = new File([blob], 'hello.txt', { type: 'text/plain' });
});
const blob = new Blob(['Hello, World!'], { type: 'text/plain' })
file = new File([blob], 'hello.txt', { type: 'text/plain' })
})

describe('toDataURL', () => {
it('should convert file to data URL', async () => {
const dataURL = await toDataURL(file);
expect(dataURL).toMatch(/^data:text\/plain;base64,/);
});
});
const dataURL = await toDataURL(file)
expect(dataURL).toMatch(/^data:text\/plain;base64,/)
})
})

describe('toText', () => {
it('should read file as text', async () => {
const text = await toText(file);
expect(text).toBe('Hello, World!');
});
});
const text = await toText(file)
expect(text).toBe('Hello, World!')
})
})

describe('toArrayBuffer', () => {
it('should read file as array buffer', async () => {
const arrayBuffer = await toArrayBuffer(file);
expect(arrayBuffer).toBeInstanceOf(ArrayBuffer);
const arrayBuffer = await toArrayBuffer(file)
expect(arrayBuffer).toBeInstanceOf(ArrayBuffer)

const uint8Array = new Uint8Array(arrayBuffer);
const text = new TextDecoder().decode(uint8Array);
expect(text).toBe('Hello, World!');
});
});
});
const uint8Array = new Uint8Array(arrayBuffer)
const text = new TextDecoder().decode(uint8Array)
expect(text).toBe('Hello, World!')
})
})
})
2 changes: 1 addition & 1 deletion tests/general.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
isTruthy,
toRawType,
hasOwn,
} from '../src/general'
} from '../src'

it('isNonEmptyArray', () => {
expect(isNonEmptyArray([])).toBe(false)
Expand Down
2 changes: 1 addition & 1 deletion tests/json.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
import { tryParseJSON, prettyJSONObject } from '../src/json'
import { tryParseJSON, prettyJSONObject } from '../src'

describe('JSON utility functions', () => {
it('should parse valid JSON strings', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/number.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
import { toNumber, clamp, clampArrayRange, genNumberKey, randomNumber } from '../src/number'
import { toNumber, clamp, clampArrayRange, genNumberKey, randomNumber } from '../src'

describe('Number utility functions', () => {
it('should convert various types to number', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/storage.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect, beforeEach, vi } from 'vitest'
import { createStorage, sessionStorage, localStorage } from '../src/storage'
import { createStorage, sessionStorage, localStorage } from '../src'

describe('Storage utility functions', () => {
let mockStorage: Storage
Expand All @@ -9,7 +9,7 @@ describe('Storage utility functions', () => {
mockStorage = {
length: 0,
clear: vi.fn(() => {
Object.keys(store).forEach(key => {
Object.keys(store).forEach((key) => {
delete store[key]
})
}),
Expand Down
2 changes: 1 addition & 1 deletion tests/string.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect } from 'vitest'
import { pascalCase, camelize, kebabCase, slash, genStringKey, capitalizeFirstLetter } from '../src/string'
import { pascalCase, camelize, kebabCase, slash, genStringKey, capitalizeFirstLetter } from '../src'

describe('string utility functions', () => {
it('should convert string to pascal case', () => {
Expand Down

0 comments on commit 34cc499

Please sign in to comment.