mirror of
https://github.com/sern-handler/tools
synced 2026-06-06 01:16:59 +00:00
ensure tests
This commit is contained in:
37
.github/workflows/localization-publish-dev.yml
vendored
37
.github/workflows/localization-publish-dev.yml
vendored
@@ -1,37 +0,0 @@
|
|||||||
name: Continuous Delivery
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- 'packages/localizer/*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
Publish:
|
|
||||||
name: Publishing Dev
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check out Git repository
|
|
||||||
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
|
|
||||||
|
|
||||||
- name: Set up Node.js
|
|
||||||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
|
|
||||||
with:
|
|
||||||
node-version: 18
|
|
||||||
registry-url: 'https://registry.npmjs.org'
|
|
||||||
|
|
||||||
- name: Install Node.js dependencies
|
|
||||||
run: yarn
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: npm run build
|
|
||||||
working-directory: ./packages/localizer
|
|
||||||
|
|
||||||
- name: Publish to npm
|
|
||||||
run: |
|
|
||||||
npm publish
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
working-directory: ./packages/localizer
|
|
||||||
@@ -61,11 +61,19 @@ describe('dfsApplyLocalization', () => {
|
|||||||
options: [{ type: 3, name: 'subItem1' }],
|
options: [{ type: 3, name: 'subItem1' }],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
const deps = { localizer: { translationsFor: vi.fn() } };
|
const deps = { localizer: { translationsFor: vi.fn(() => true) } };
|
||||||
const path = ['root'];
|
const path = ['root'];
|
||||||
|
|
||||||
dfsApplyLocalization(items, deps, path);
|
dfsApplyLocalization(items, deps, path);
|
||||||
|
expect(items).to.deep.equal([
|
||||||
|
{
|
||||||
|
name: 'item1',
|
||||||
|
type: 1,
|
||||||
|
options: [{ type: 3, name: 'subItem1', name_localizations: true, description_localizations: true }],
|
||||||
|
name_localizations: true,
|
||||||
|
description_localizations: true
|
||||||
|
},
|
||||||
|
])
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should apply localizations to choices', () => {
|
it('should apply localizations to choices', () => {
|
||||||
@@ -80,19 +88,15 @@ describe('dfsApplyLocalization', () => {
|
|||||||
const path = ['root'];
|
const path = ['root'];
|
||||||
|
|
||||||
dfsApplyLocalization(items, deps, path);
|
dfsApplyLocalization(items, deps, path);
|
||||||
console.log(items[0].choices)
|
expect(items).to.deep.equal([
|
||||||
|
{
|
||||||
|
name: 'item1',
|
||||||
|
name_localizations: 'a',
|
||||||
|
description_localizations: 'a',
|
||||||
|
//@ts-ignore
|
||||||
|
choices: [{ name: 'choice1', name_localizations: 'a' },
|
||||||
|
{ name: 'choice2', name_localizations: 'a' }],
|
||||||
|
}
|
||||||
|
])
|
||||||
});
|
});
|
||||||
it('should call applyLocalization n times, n = num of options', () => {
|
|
||||||
|
|
||||||
const items: Option[] = [
|
|
||||||
{
|
|
||||||
name: 'item1',
|
|
||||||
type: 3,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "item2",
|
|
||||||
type: 4
|
|
||||||
}
|
|
||||||
];
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user