-

-
+
+
+
+

+
DICE
+
+
+
+
+
+
+
diff --git a/src/assets/logo.png b/src/assets/logo.png
deleted file mode 100644
index f3d2503..0000000
Binary files a/src/assets/logo.png and /dev/null differ
diff --git a/src/assets/logo.svg b/src/assets/logo.svg
new file mode 100644
index 0000000..eef08cc
--- /dev/null
+++ b/src/assets/logo.svg
@@ -0,0 +1,38 @@
+
+
+
+
diff --git a/src/components/Balance.vue b/src/components/Balance.vue
new file mode 100644
index 0000000..6c428bc
--- /dev/null
+++ b/src/components/Balance.vue
@@ -0,0 +1,38 @@
+
+
+
+
+
+
Your balanse $
+
+
Free credits are available only with zero balance.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/Board.vue b/src/components/Board.vue
new file mode 100644
index 0000000..9003ece
--- /dev/null
+++ b/src/components/Board.vue
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
diff --git a/src/components/HelloWorld.vue b/src/components/HelloWorld.vue
deleted file mode 100644
index cee6464..0000000
--- a/src/components/HelloWorld.vue
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
{{ msg }}
-
- For guide and recipes on how to configure / customize this project,
- check out the
- vue-cli documentation.
-
-
Installed CLI Plugins
-
-
Essential Links
-
-
Ecosystem
-
-
-
-
-
-
-
-
diff --git a/src/components/Info.vue b/src/components/Info.vue
new file mode 100644
index 0000000..90ee07e
--- /dev/null
+++ b/src/components/Info.vue
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
Previous val:
+
{{ info.previous.val }}
+
+
+
+
+
+
+
Previous key:
+
{{ info.previous.key }}
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/helpers/Animated.vue b/src/components/helpers/Animated.vue
new file mode 100644
index 0000000..8c9ee73
--- /dev/null
+++ b/src/components/helpers/Animated.vue
@@ -0,0 +1,50 @@
+
+ {{ tweeningValue }}
+
+
+
+
+
diff --git a/src/components/helpers/Card.vue b/src/components/helpers/Card.vue
new file mode 100644
index 0000000..d5a22ce
--- /dev/null
+++ b/src/components/helpers/Card.vue
@@ -0,0 +1,26 @@
+
+
+
+
+
+
Values: {{ info.msg }}
+
Chance: {{ info.chance }}%
+
Payout: x{{ info.multiplier }}
+
+
+
+
+
+
+
+
+
diff --git a/src/main.js b/src/main.js
index 77f35b6..81cce54 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,3 +1,7 @@
+// Inject materialize-css framework
+import 'materialize-css';
+import 'materialize-css/dist/css/materialize.css';
+
import Vue from 'vue';
import App from './App.vue';
diff --git a/tests/unit/Board.spec.js b/tests/unit/Board.spec.js
new file mode 100644
index 0000000..cb0c28e
--- /dev/null
+++ b/tests/unit/Board.spec.js
@@ -0,0 +1,65 @@
+import CryptoJS from 'crypto-js';
+
+import { shallow } from '@vue/test-utils';
+import Board from '@/components/Board.vue';
+
+const getCurrent = () => {
+ let key = Math.random().toString(36).substr(2, 8);
+ let val = Math.floor(Math.random() * 100).toString();
+
+ key = CryptoJS.SHA3(key, { outputLength: 256 }).toString(CryptoJS.enc.Base64);
+ val = CryptoJS.AES.encrypt(val, key).toString();
+
+ return { key, val };
+};
+const info = {
+ balance: 100,
+};
+
+describe('Board.vue component', () => {
+ describe('Check computed bid/multiplier', () => {
+ const current = getCurrent();
+ const wrapper = shallow(Board, {
+ propsData: { current, info },
+ });
+
+ it('Bet 50 Hi Chance of Winning', () => {
+ wrapper.setData({
+ number: 50,
+ });
+
+ const { high: { chance, multiplier } } = wrapper.vm.bid;
+
+ expect(chance).toEqual(50);
+ expect(multiplier).toEqual(2);
+ });
+
+ it('Bet 1 Hi/Lo Chance of Winning', () => {
+ wrapper.setData({
+ number: 1,
+ });
+
+ const { high, low } = wrapper.vm.bid;
+
+ expect(high.chance).toEqual(99);
+ expect(high.multiplier).toEqual(1.01);
+
+ expect(low.chance).toEqual(1);
+ expect(low.multiplier).toEqual(100);
+ });
+
+ it('Bet 10 Hi/Lo Chance of Winning', () => {
+ wrapper.setData({
+ number: 10,
+ });
+
+ const { high, low } = wrapper.vm.bid;
+
+ expect(high.chance).toEqual(90);
+ expect(high.multiplier).toEqual(1.11);
+
+ expect(low.chance).toEqual(10);
+ expect(low.multiplier).toEqual(10);
+ });
+ });
+});
diff --git a/tests/unit/HelloWorld.spec.js b/tests/unit/HelloWorld.spec.js
deleted file mode 100644
index e2dcea5..0000000
--- a/tests/unit/HelloWorld.spec.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { shallow } from '@vue/test-utils';
-import HelloWorld from '@/components/HelloWorld.vue';
-
-describe('HelloWorld.vue', () => {
- it('renders props.msg when passed', () => {
- const msg = 'new message';
- const wrapper = shallow(HelloWorld, {
- propsData: { msg },
- });
- expect(wrapper.text()).toMatch(msg);
- });
-});
diff --git a/tests/unit/Info.spec.js b/tests/unit/Info.spec.js
new file mode 100644
index 0000000..86e2141
--- /dev/null
+++ b/tests/unit/Info.spec.js
@@ -0,0 +1,58 @@
+import { shallow } from '@vue/test-utils';
+import Info from '@/components/Info.vue';
+
+const previous = {
+ key: 'This is the key',
+ val: 'This is the val',
+};
+
+describe('Info.vue component', () => {
+ it('renders info.previous when this object passed', () => {
+ const info = { previous };
+
+ const wrapper = shallow(Info, {
+ propsData: { info },
+ });
+
+ const { key, val } = wrapper.props().info.previous;
+
+ expect(key).toMatch(previous.key);
+ expect(val).toMatch(previous.val);
+ });
+ it('renders status when user win', () => {
+ const info = {
+ status: true,
+ amount: 10,
+ previous,
+ };
+
+ const wrapper = shallow(Info, {
+ propsData: { info },
+ });
+
+ const { status } = wrapper.vm;
+
+ expect(status.charge).toEqual(10);
+ expect(status.msg).toMatch('You won! +$');
+
+ expect(status.clr).toMatch('green');
+ });
+ it('renders status when user lose', () => {
+ const info = {
+ status: false,
+ amount: -10,
+ previous,
+ };
+
+ const wrapper = shallow(Info, {
+ propsData: { info },
+ });
+
+ const { status } = wrapper.vm;
+
+ expect(status.charge).toEqual(10);
+ expect(status.msg).toMatch('You lose! -$');
+
+ expect(status.clr).toMatch('red');
+ });
+});