Skip to content

Commit

Permalink
add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
ekhaled committed Sep 8, 2021
1 parent 4abe1ac commit 7c4bbe3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
15 changes: 12 additions & 3 deletions test/svelte3/integration/data/data.export.aliace.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
<script>
/**
* Description for variable that must be exported later
/**
* Description for variable that must be exported later
* @type {Array<string>}
*/
const classes = [ 'btn' ];
export {
export {
classes as class
};
/**
* Switch parameter
* @type {'main' | 'sidebar'}
*
*/
let switchValue = "main";
export {switchValue as switch}
</script>
17 changes: 15 additions & 2 deletions test/svelte3/integration/data/data.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ describe('SvelteDoc v3 - Props', () => {
expect(doc, 'Document should be provided').to.exist;
expect(doc.data, 'Document data should be parsed').to.exist;

expect(doc.data.length).to.equal(2);
expect(doc.data.length).to.equal(4);

const prop = doc.data.find(d => d.name === 'class');

Expand All @@ -429,12 +429,25 @@ describe('SvelteDoc v3 - Props', () => {
expect(prop.type).to.eql({ kind: 'type', type: 'Array<string>', text: 'Array<string>' });

expect(prop.locations, 'Code location should be parsed').to.be.exist;
expect(prop.locations[0]).is.deep.equals({ start: 181, end: 186 });
expect(prop.locations[0]).is.deep.equals({ start: 178, end: 183 });

const localProp = doc.data.find(d => d.name === 'classes');

expect(localProp, 'Local prop definition also must be provided').to.exist;

const prop2 = doc.data.find(d => d.name === 'switch');
expect(prop2).to.exist;
expect(prop2.name, 'Aliace name must be exposed instead of original name').to.equal('switch');
expect(prop2.localName, 'Local name must be stored').to.equal('switchValue');
expect(prop2.defaultValue).to.equal("main");
expect(prop2.keywords).to.exist;
expect(prop2.keywords.length).to.equal(1);

const keyword = prop2.keywords[0];

expect(keyword.name).to.equal('type');
expect(keyword.description).to.equal("{'main' | 'sidebar'}");

done();
}).catch(e => {
done(e);
Expand Down

0 comments on commit 7c4bbe3

Please sign in to comment.