Use Jest's fake timers
This commit is contained in:
parent
fea37bc512
commit
7cfb961e2b
|
|
@ -84,6 +84,7 @@
|
||||||
},
|
},
|
||||||
"jest": {
|
"jest": {
|
||||||
"resetMocks": true,
|
"resetMocks": true,
|
||||||
|
"timers": "fake",
|
||||||
"transform": {
|
"transform": {
|
||||||
"^.+\\.js$": "babel-jest",
|
"^.+\\.js$": "babel-jest",
|
||||||
".*\\.vue$": "vue-jest"
|
".*\\.vue$": "vue-jest"
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,6 @@ test('different categories', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('search textures', () => {
|
test('search textures', () => {
|
||||||
jest.useFakeTimers();
|
|
||||||
Vue.prototype.$http.get.mockResolvedValue({});
|
Vue.prototype.$http.get.mockResolvedValue({});
|
||||||
|
|
||||||
const wrapper = mount(Closet);
|
const wrapper = mount(Closet);
|
||||||
|
|
@ -90,8 +89,6 @@ test('search textures', () => {
|
||||||
page: 1,
|
page: 1,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
jest.useRealTimers();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('empty closet', () => {
|
test('empty closet', () => {
|
||||||
|
|
@ -178,7 +175,6 @@ test('select texture', async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('apply texture', async () => {
|
test('apply texture', async () => {
|
||||||
jest.useFakeTimers();
|
|
||||||
window.$ = jest.fn(() => ({
|
window.$ = jest.fn(() => ({
|
||||||
iCheck: () => ({
|
iCheck: () => ({
|
||||||
on(evt, cb) {
|
on(evt, cb) {
|
||||||
|
|
@ -209,8 +205,6 @@ test('apply texture', async () => {
|
||||||
.toHaveProperty('src', '/avatar/35/10');
|
.toHaveProperty('src', '/avatar/35/10');
|
||||||
expect(wrapper.find('.modal-body').text()).toContain('name');
|
expect(wrapper.find('.modal-body').text()).toContain('name');
|
||||||
jest.runAllTimers();
|
jest.runAllTimers();
|
||||||
|
|
||||||
jest.useRealTimers();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('submit applying texture', async () => {
|
test('submit applying texture', async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user