Skip to content

Commit

Permalink
0.1.3: fix emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Jul 13, 2023
1 parent 259ef4f commit fe190b6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@libreservice/micro-plum",
"version": "0.1.2",
"version": "0.1.3",
"main": "dist/index.js",
"type": "module",
"files": [
Expand Down
3 changes: 2 additions & 1 deletion src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ class Recipe {
}

async loadFile (file: string) {
if (file === 'opencc/emoji.json') {
// Don't download emoji.json from current repo, unless this is the emoji repo
if (file === 'opencc/emoji.json' && this.repo !== 'rime/rime-emoji') {
return
}
if (file in this.loadedFiles) {
Expand Down
16 changes: 10 additions & 6 deletions test/test-loader.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,17 @@ it('CDN prefix', () => {
}
})

const genericRecipeTestCases = {
essay: ['essay.txt'],
emoji: ['emoji_suggestion.yaml', 'opencc/emoji.json']
}

it('Load generic recipe', async () => {
const recipe = new Recipe('essay')
const result = await recipe.load()
expect(result).toEqual([{
file: 'essay.txt',
content: undefined
}])
for (const [target, files] of Object.entries(genericRecipeTestCases)) {
const recipe = new Recipe(target)
const result = await recipe.load()
expect(result.map(item => item.file).sort()).toEqual(files)
}
})

it('Load recipe', async () => {
Expand Down

0 comments on commit fe190b6

Please sign in to comment.