mirror of
https://github.com/wassname/talk.git
synced 2026-09-10 12:43:11 +08:00
simplified test layout
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
const expect = require('chai').expect;
|
||||
|
||||
const User = require('../../../models/user');
|
||||
const Context = require('../../../graph/context');
|
||||
const errors = require('../../../errors');
|
||||
const SettingsService = require('../../../services/settings');
|
||||
|
||||
const {expect} = require('chai');
|
||||
|
||||
describe('graph.Context', () => {
|
||||
beforeEach(() => SettingsService.init());
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const {expect} = require('chai');
|
||||
const {graphql} = require('graphql');
|
||||
|
||||
const schema = require('../../../../graph/schema');
|
||||
@@ -9,6 +8,8 @@ const SettingsService = require('../../../../services/settings');
|
||||
const ActionModel = require('../../../../models/action');
|
||||
const CommentModel = require('../../../../models/comment');
|
||||
|
||||
const {expect} = require('chai');
|
||||
|
||||
describe('graph.loaders.Metrics', () => {
|
||||
beforeEach(() => SettingsService.init());
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const expect = require('chai').expect;
|
||||
const {graphql} = require('graphql');
|
||||
|
||||
const schema = require('../../../../graph/schema');
|
||||
@@ -8,6 +7,8 @@ const UserModel = require('../../../../models/user');
|
||||
const SettingsService = require('../../../../services/settings');
|
||||
const CommentsService = require('../../../../services/comments');
|
||||
|
||||
const {expect} = require('chai');
|
||||
|
||||
describe('graph.mutations.addTag', () => {
|
||||
let comment, asset;
|
||||
beforeEach(async () => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const expect = require('chai').expect;
|
||||
const {graphql} = require('graphql');
|
||||
|
||||
const schema = require('../../../../graph/schema');
|
||||
@@ -11,6 +10,8 @@ const ActionModel = require('../../../../models/action');
|
||||
const SettingsService = require('../../../../services/settings');
|
||||
const CommentsService = require('../../../../services/comments');
|
||||
|
||||
const {expect} = require('chai');
|
||||
|
||||
describe('graph.mutations.createComment', () => {
|
||||
beforeEach(() => SettingsService.init());
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const expect = require('chai').expect;
|
||||
const {graphql} = require('graphql');
|
||||
const timekeeper = require('timekeeper');
|
||||
|
||||
@@ -9,6 +8,8 @@ const AssetModel = require('../../../../models/asset');
|
||||
const SettingsService = require('../../../../services/settings');
|
||||
const CommentsService = require('../../../../services/comments');
|
||||
|
||||
const {expect} = require('chai');
|
||||
|
||||
describe('graph.mutations.editComment', () => {
|
||||
let asset;
|
||||
let user;
|
||||
@@ -133,7 +134,7 @@ describe('graph.mutations.editComment', () => {
|
||||
expect(response.errors).to.be.empty;
|
||||
expect(response.data.editComment.errors).to.not.be.empty;
|
||||
expect(response.data.editComment.errors[0].translation_key).to.equal('NOT_AUTHORIZED');
|
||||
const commentAfterEdit = await CommentsService.findById(comment.id);
|
||||
const commentAfterEdit = await CommentsService.findById(comment.id);
|
||||
|
||||
// it *hasn't* changed from the original
|
||||
expect(commentAfterEdit.body).to.equal(comment.body);
|
||||
@@ -256,7 +257,7 @@ describe('graph.mutations.editComment', () => {
|
||||
expect(response.errors).to.be.empty;
|
||||
const commentAfterEdit = await CommentsService.findById(comment.id);
|
||||
expect(commentAfterEdit.body).to.equal(newBody);
|
||||
expect(commentAfterEdit.status).to.equal(afterEdit.status);
|
||||
expect(commentAfterEdit.status).to.equal(afterEdit.status);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const expect = require('chai').expect;
|
||||
const {graphql} = require('graphql');
|
||||
|
||||
const schema = require('../../../../graph/schema');
|
||||
@@ -6,6 +5,8 @@ const Context = require('../../../../graph/context');
|
||||
const UsersService = require('../../../../services/users');
|
||||
const SettingsService = require('../../../../services/settings');
|
||||
|
||||
const {expect} = require('chai');
|
||||
|
||||
const ignoreUserMutation = `
|
||||
mutation ignoreUser ($id: ID!) {
|
||||
ignoreUser(id:$id) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const expect = require('chai').expect;
|
||||
const {graphql} = require('graphql');
|
||||
|
||||
const schema = require('../../../../graph/schema');
|
||||
@@ -11,6 +10,8 @@ const SettingsService = require('../../../../services/settings');
|
||||
const CommentsService = require('../../../../services/comments');
|
||||
const TagsService = require('../../../../services/tags');
|
||||
|
||||
const {expect} = require('chai');
|
||||
|
||||
describe('graph.mutations.removeTag', () => {
|
||||
let asset, comment;
|
||||
beforeEach(async () => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
const expect = require('chai').expect;
|
||||
const {graphql} = require('graphql');
|
||||
|
||||
const schema = require('../../../../graph/schema');
|
||||
@@ -8,6 +7,8 @@ const SettingsService = require('../../../../services/settings');
|
||||
const Asset = require('../../../../models/asset');
|
||||
const CommentsService = require('../../../../services/comments');
|
||||
|
||||
const {expect} = require('chai');
|
||||
|
||||
describe('graph.queries.asset', () => {
|
||||
let asset, users;
|
||||
beforeEach(async () => {
|
||||
|
||||
Reference in New Issue
Block a user