Skip to content

Commit

Permalink
Add unit test for app manifest reading
Browse files Browse the repository at this point in the history
  • Loading branch information
doosuu committed Aug 17, 2023
1 parent 05cab57 commit 087b50e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions test/unit/app-manifest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { expect } from 'chai';
describe('app-manifest - module', () => {
before(() => {
const mockfsConf: any = {
'/AppManifest.json': 'foo',
'/AppManifestInvalid.json': 'foo',
'/AppManifestValid.json': '{ "name": "AppName", "manifestVersion": "v3" }'
};
mockfs(mockfsConf, { createCwd: false });
});
Expand All @@ -30,7 +31,14 @@ describe('app-manifest - module', () => {
});

it('should throw an error if file is present, but cannot be read.', () => {
expect(readAppManifest.bind(readAppManifest, '/AppManifest.json')).to.throw();
expect(readAppManifest.bind(readAppManifest, '/AppManifestInvalid.json')).to.throw();
});

it('should read the file and return proper content', () => {
const appManifest = readAppManifest('/AppManifestValid.json');

expect(appManifest['name']).to.be.eq('AppName');
expect(appManifest['manifestVersion']).to.be.eq('v3');
});
});
after(() => {
Expand Down

0 comments on commit 087b50e

Please sign in to comment.