Skip to content

Commit

Permalink
chore: add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
megheaiulian committed Apr 9, 2024
1 parent 868c5ab commit 0995988
Show file tree
Hide file tree
Showing 5 changed files with 210 additions and 20 deletions.
178 changes: 178 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,10 @@
"@commitlint/cli": "^19.0.0",
"@commitlint/config-conventional": "^19.0.0",
"@neovici/cfg": "^1.20.1",
"@open-wc/testing": "^4.0.0",
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@types/mocha": "^10.0.6",
"husky": "^9.0.0",
"prettier": "^3.0.0",
"semantic-release": "^23.0.0",
Expand Down
12 changes: 12 additions & 0 deletions test/__snapshots__/cosmoz-collapse.test.snap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/* @web/test-runner snapshot v1 */
export const snapshots = {};

snapshots["cosmoz-collapse renders opened"] =

Check failure on line 4 in test/__snapshots__/cosmoz-collapse.test.snap.js

View workflow job for this annotation

GitHub Actions / build / build

Strings must use singlequote
`<cosmoz-collapse opened="">
<p>
Lore ipsum
</p>
</cosmoz-collapse>
`;
/* end snapshot cosmoz-collapse renders opened */

11 changes: 11 additions & 0 deletions test/cosmoz-collapse.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import '../src/cosmoz-collapse';
import { expect, html, fixture } from '@open-wc/testing';

describe('cosmoz-collapse', () => {
it('renders opened', async () => {
const el = await fixture(
html`<cosmoz-collapse opened><p>Lore ipsum</p></cosmoz-collapse>`,
);
await expect(el).dom.to.equalSnapshot();
});
});
27 changes: 7 additions & 20 deletions web-test-runner.config.mjs
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
import {
chromeLauncher, defaultReporter
} from '@web/test-runner';
import { seleniumLauncher } from '@web/test-runner-selenium';
import webdriver from 'selenium-webdriver';
import firefox from 'selenium-webdriver/firefox.js';
import cfg from '@neovici/cfg/web/test-runner.mjs';

export default {
nodeResolve: true,
...cfg,
coverageConfig: {
reportDir: 'coverage',
threshold: {
statements: 70,
branches: 70,
statements: 65,
branches: 65,
functions: 50,
lines: 70
}
lines: 65,
},
},
files: [
'**!(node_modules)/*.test.js'
],
browsers: [
chromeLauncher(),
seleniumLauncher({
driverBuilder: new webdriver.Builder().forBrowser('firefox').setFirefoxOptions(new firefox.Options().headless())
})
]

testFramework: { config: { ui: 'bdd' } },
};

0 comments on commit 0995988

Please sign in to comment.