-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* improve: asset import * add: support for .mp3/.wav/.ogg files
- Loading branch information
1 parent
beb3642
commit d7b961d
Showing
6 changed files
with
171 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
packages/@dcl/inspector/src/components/ImportAsset/utils.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getRandomMnemonic, nouns, adjectives } from './utils' | ||
|
||
describe('getRandomMnemonic', () => { | ||
it('should return a string with a random adjective and noun', () => { | ||
const mnemonic = getRandomMnemonic() | ||
const [adjective, noun] = mnemonic.split('-') | ||
|
||
expect(adjectives).toContain(adjective) | ||
expect(nouns).toContain(noun) | ||
}) | ||
|
||
it('should return a valid mnemonic', () => { | ||
const mnemonic = getRandomMnemonic() | ||
const parts = mnemonic.split('-') | ||
|
||
expect(parts.length).toBe(2) | ||
expect(adjectives).toContain(parts[0]) | ||
expect(nouns).toContain(parts[1]) | ||
}) | ||
}) |
91 changes: 91 additions & 0 deletions
91
packages/@dcl/inspector/src/components/ImportAsset/utils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
const sampleIndex = (list: any[]) => Math.floor(Math.random() * list.length) | ||
|
||
export function getRandomMnemonic() { | ||
return `${adjectives[sampleIndex(adjectives)]}-${nouns[sampleIndex(nouns)]}` | ||
} | ||
|
||
export const nouns = [ | ||
'transportation', | ||
'chest', | ||
'variation', | ||
'director', | ||
'tale', | ||
'extent', | ||
'interaction', | ||
'exam', | ||
'combination', | ||
'movie', | ||
'literature', | ||
'significance', | ||
'member', | ||
'priority', | ||
'analyst', | ||
'audience', | ||
'food', | ||
'complaint', | ||
'wedding', | ||
'awareness', | ||
'outcome', | ||
'army', | ||
'resolution', | ||
'ratio', | ||
'baseball', | ||
'family', | ||
'excitement', | ||
'cheek', | ||
'payment', | ||
'freedom', | ||
'sir', | ||
'storage', | ||
'elevator', | ||
'satisfaction', | ||
'organization', | ||
'agency', | ||
'industry', | ||
'arrival', | ||
'thanks', | ||
'hall' | ||
] | ||
|
||
export const adjectives = [ | ||
'cluttered', | ||
'tricky', | ||
'scandalous', | ||
'rampant', | ||
'well-off', | ||
'abashed', | ||
'fallacious', | ||
'adventurous', | ||
'dizzy', | ||
'huge', | ||
'youthful', | ||
'succinct', | ||
'legal', | ||
'purring', | ||
'wise', | ||
'jagged', | ||
'smart', | ||
'learned', | ||
'relieved', | ||
'plain', | ||
'pushy', | ||
'vast', | ||
'heady', | ||
'vagabond', | ||
'disillusioned', | ||
'obese', | ||
'electric', | ||
'far', | ||
'unaccountable', | ||
'loud', | ||
'early', | ||
'wealthy', | ||
'long', | ||
'thinkable', | ||
'sordid', | ||
'striped', | ||
'violet', | ||
'likeable', | ||
'cheap', | ||
'absorbed' | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters