You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							26 lines
						
					
					
						
							828 B
						
					
					
				
			
		
		
	
	
							26 lines
						
					
					
						
							828 B
						
					
					
				| const { assert } = require('chai');
 | |
| const storage = require('../src/storage');
 | |
| 
 | |
| describe('storage', () => {
 | |
|     it('should store a task', () => {
 | |
|         global.scheduledTasks = new Map();
 | |
|         storage.save({});
 | |
|         assert.lengthOf(global.scheduledTasks, 1);
 | |
|     });
 | |
| 
 | |
|     it('should get all tasks', () => {
 | |
|         global.scheduledTasks = new Map();
 | |
|         global.scheduledTasks.set(0, {});
 | |
|         assert.lengthOf(storage.getTasks(), 1);
 | |
|     });
 | |
| 
 | |
|     describe('on import', () => {
 | |
|         it('should keep stored items across imports', () => {
 | |
|             delete require.cache[require.resolve('../src/storage')];
 | |
|             global.scheduledTasks = new Map();
 | |
|             storage.save({});
 | |
|             let storage2 = require('../src/storage');
 | |
|             assert.lengthOf(storage2.getTasks(), 1);
 | |
|         });
 | |
|     });
 | |
| }); |