小编dev*_*ran的帖子

用玩笑嘲笑导入的打字稿中的类

我正在尝试使用开玩笑来模拟Typescript类中的导入类,以下代码用于主程序(我从函数内部删除了一些代码,但仍应清楚我要做什么)

import * as SocketIO from "socket.io";

import {AuthenticatedDao} from "../../dao/authenticated.dao";

export default class AuthenticationService {
    private readonly _authenticatedDao: AuthenticatedDao = AuthenticatedDao.Instance;
    private readonly _io;

    constructor(socketIo: SocketIO.Server) {
        this._io = socketIo;
    }

    public authenticateUser(username: string, password: string, clientSocketId: string): void {
        this._authenticatedDao.authenticateUser(username, password).then((authenticatedUser) => {

        }).catch(rejected => {

        });
    }
}


import {createServer, Server} from 'http';
import * as express from 'express';
import * as socketIo from 'socket.io';
import {LogincredentialsDto} from "./models/dto/logincredentials.dto";
import {config} from './config/config';
import AuthenticationService from "./services/implementation/authentication.service"; …
Run Code Online (Sandbox Code Playgroud)

testing unit-testing typescript jestjs

2
推荐指数
1
解决办法
4269
查看次数

标签 统计

jestjs ×1

testing ×1

typescript ×1

unit-testing ×1