diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e76ee29 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false \ No newline at end of file diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml index 1a25628..ddec05d 100644 --- a/.github/workflows/build-deploy.yml +++ b/.github/workflows/build-deploy.yml @@ -3,7 +3,7 @@ name: Build and deploy on: push: - branches: ['main'] + branches: [ 'main' ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -36,6 +36,8 @@ jobs: cache: 'npm' - name: Install dependencies run: npm install + - name: Test + run: npm run test - name: Build run: npm run build diff --git a/tests/footer.test.ts b/tests/footer.test.ts index 4f87885..09d0fd9 100644 --- a/tests/footer.test.ts +++ b/tests/footer.test.ts @@ -5,20 +5,20 @@ import Footer from "../src/components/Footer.vue"; import {secToTime} from "../src/composables/secToTime"; test('mount component', async () => { - expect(Footer).toBeTruthy() + expect(Footer).toBeTruthy() - const wrapper = mount(Footer, { - props: {totalUsers: 10, totalTime: 120}, - }) + const wrapper = mount(Footer, { + props: {totalUsers: 10, totalTime: 120}, + }) - expect(wrapper.text()).toContain('10 users') - expect(wrapper.text()).toContain(`(${secToTime(120)})`) + expect(wrapper.text()).toContain('10 users') + expect(wrapper.text()).toContain(`(${secToTime(120)})`) - await wrapper.get('img').trigger('click') - expect(wrapper.emitted()).toHaveProperty('randomize') + await wrapper.get('img').trigger('click') + expect(wrapper.emitted()).toHaveProperty('randomize') - await wrapper.setProps({totalUsers: 2, totalTime: 15}) - expect(wrapper.text()).toContain('2 users') - expect(wrapper.text()).toContain(`(${secToTime(15)})`) -}) \ No newline at end of file + await wrapper.setProps({totalUsers: 2, totalTime: 15}) + expect(wrapper.text()).toContain('2 users') + expect(wrapper.text()).toContain(`(${secToTime(15)})`) +}) diff --git a/tests/secToTime.test.ts b/tests/secToTime.test.ts index 88c2d03..8cc6198 100644 --- a/tests/secToTime.test.ts +++ b/tests/secToTime.test.ts @@ -1,15 +1,15 @@ -import { expect, test } from 'vitest' +import {expect, test} from 'vitest' import {secToTime} from "../src/composables/secToTime"; test('secToTime works', () => { - expect(secToTime(0)).toBe("00:00") - expect(secToTime(1)).toBe("00:01") - expect(secToTime(59)).toBe("00:59") - expect(secToTime(60)).toBe("01:00") - expect(secToTime(61)).toBe("01:01") - expect(secToTime(120)).toBe("02:00") - - expect(secToTime(3600)).toBe("60:00") - expect(secToTime(3601)).toBe("60:01") - expect(secToTime(3661)).toBe("61:01") -}) \ No newline at end of file + expect(secToTime(0)).toBe("00:00") + expect(secToTime(1)).toBe("00:01") + expect(secToTime(59)).toBe("00:59") + expect(secToTime(60)).toBe("01:00") + expect(secToTime(61)).toBe("01:01") + expect(secToTime(120)).toBe("02:00") + + expect(secToTime(3600)).toBe("60:00") + expect(secToTime(3601)).toBe("60:01") + expect(secToTime(3661)).toBe("61:01") +}) diff --git a/vite.config.ts b/vite.config.ts index 7a46b45..5e04e95 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,14 +1,15 @@ +/// import {defineConfig} from 'vite' import vue from '@vitejs/plugin-vue' // https://vitejs.dev/config/ export default defineConfig({ - plugins: [vue()], - base: '/standup-timer/', - test: { - // vitest specific configuration. + plugins: [vue()], + base: '/standup-timer/', + test: { + // vitest specific configuration. - // The testing environment. Simulate a DOM, so that Vue Components can be tested too. - environment: 'happy-dom' - } + // The testing environment. Simulate a DOM, so that Vue Components can be tested too. + environment: 'happy-dom' + } })