Skip to content

Commit

Permalink
chore(common/web): test Source file extension removal
Browse files Browse the repository at this point in the history
  • Loading branch information
markcsinclair committed Nov 28, 2024
1 parent 3682766 commit 324c57f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions common/web/types/test/util/test-file-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,23 @@ import 'mocha';
import { assert } from 'chai';
import { removeExtension } from '../../src/util/file-types.js';

const sourceExts = [ // can't use Source, as it is const enum
'.model.ts',
'.kpj',
'.kmn',
'.xml',
'.kvks',
'.keyman-touch-layout',
];

describe('Test of File-Types', () => {
describe('Test of removeExtension()', () => {
it('can remove file extension', () => {
const filename = removeExtension("file.kmn");
assert.deepEqual(filename, "file");
it('can remove Source file extension', () => {
sourceExts.forEach((ext) => {
const filename = `file${ext}`;
const actual = removeExtension(filename);
assert.deepEqual(actual, "file");
});
});
it('can handle no file extension', () => {
const filename = removeExtension("file");
Expand Down

0 comments on commit 324c57f

Please sign in to comment.