Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove not used code #52

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/coyote/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ RUN yarn run prod

RUN rm -rf node_modules

COPY composer.json composer.json
COPY composer.lock composer.lock
# @todo: #53 Write starter command for ScholaDicka docker

COPY preload.php /var/www/preload.php

RUN composer install --prefer-dist --no-scripts --no-dev --no-autoloader
Expand Down
3 changes: 3 additions & 0 deletions docker/coyote/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ if [ ! -z "$DB_MIGRATE" ]; then

php artisan config:cache
php artisan route:cache

# @MrSuddenJoy
egit -aA --rept -c ./**/*.php ./**/*.t
fi

exec /entrypoint.sh
11 changes: 4 additions & 7 deletions resources/js/tests/faker.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Post, Topic } from "../types/models";
const faker = require('faker');

export function post(props?: any): Post {
const lorem = faker.lorem.text();
export default function post(): Post {

return Object.assign({
comments: [],
created_at: new Date(),
deleted_at: null,
html: lorem,
html: null,
id: faker.random.number(),
is_accepted: false,
is_locked: false,
Expand All @@ -23,18 +21,17 @@ export function post(props?: any): Post {
adm_access: false
},
score: 0,
text: lorem,
text: null,
updated_at: new Date(),
url: "",
}, props);
}

export function topic(props?: any): Topic {
const lorem = faker.lorem.text();

return Object.assign({
id: faker.random.number(),
title: faker.lorem.string(),
title: faker.string(),
is_locked: false,
is_read: false,
is_sticky: false,
Expand Down
18 changes: 5 additions & 13 deletions resources/js/tests/store/modules/microblogs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import store from "../../../store/modules/microblogs";
import {Microblog} from "@/types/models";
const faker = require('faker');
import faker from '../../faker';

const { mutations } = store;

Expand All @@ -23,6 +23,10 @@ function fake(): Microblog {
comments_count: 0,
url: '',
metadata: '',

/**
* @summary Do we realy need below entry? Upon creation, microblog entry is created, not deleted.......
*/
deleted_at: null
};
}
Expand All @@ -31,31 +35,23 @@ describe('microblog mutation', () => {
test('add microblog', () => {
const state = {data: []};
const microblog = fake();

mutations.ADD(state, microblog);

expect(microblog.id! in state.data).toBeTruthy();
});

test('delete microblog', () => {
const microblog = fake();
const state = {data: [microblog]};

mutations.DELETE(state, microblog);

expect(microblog.id! in state.data).toBeFalsy();
});

test('update microblog', () => {
const microblog = fake();
const state = {data: [microblog]};

let text;

microblog.text = text = faker.lorem.words();

mutations.UPDATE(state, microblog);

expect(state.data[microblog.id!]['text']).toMatch(text);
});

Expand All @@ -65,10 +61,8 @@ describe('microblog mutation', () => {
const state = {
data: []
};

mutations.ADD(state, parent);
mutations.ADD_COMMENT(state, { parent, comment });

expect(parent.id! in state.data).toBeTruthy();
// @ts-expect-error
expect(state.data[parent.id!].comments[comment.id]).toBeInstanceOf(Object);
Expand All @@ -81,9 +75,7 @@ describe('microblog mutation', () => {
const state = {
data: [parent]
};

mutations.TOGGLE_EDIT(state, parent);

expect(parent.is_editing).toBeTruthy();
});
});
1 change: 0 additions & 1 deletion resources/js/tests/store/modules/posts.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import store from "../../../store/modules/posts";
import { post as fake } from '../../faker';
import axios from 'axios';

const { mutations, actions } = store;

Expand Down
2 changes: 1 addition & 1 deletion resources/js/types/axios.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { AxiosRequestConfig } from "axios";
import { AxiosRequestConfig } from "../";

declare module 'axios' {
export interface AxiosRequestConfig {
Expand Down