describe("shipCommand", () => { it("invocation returns an instance of ShipOrderItemCommand", () => { var service = new OrderItemService(dataProxy); var command = service.shipCommand(1); expect(command instanceof ShipOrderItemCommand).toBe(true); }); });
it('Test 010 : should copy when a file exists at source and not at target', function () { const updated = FileUpdater.updatePathWithStats( testSourceFile, mockFileStats(now), testTargetFile, null); expect(updated).toBe(true); expect(mockFs.cpPaths.length).toBe(1); expect(mockFs.rmPaths.length).toBe(0); expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]); });
it('should be able to get an estimated exchange amount', async(inject([SendPageDataService], (service: SendPageDataService) => { const navCoins = 10 service.getEstimatedExchange('nav', 'nav', navCoins).then((data) => { expect(data).toBe(navCoins) }) })))
describe('isDistributed() method', () => { it("Checking isDistributed() method", (done) => { const man = new Manager(false); expect(man.isDistributed()).toBe(false); waitEvent(man, EVENTS.RUN, () => man.run(), () => { expect(man.isDistributed()).toBe(false); waitEvent(man, EVENTS.STOP, () => man.stop(), () => { expect(man.isDistributed()).toBe(false); man.destroy(done); }); }); }); });
it('Test 012 : should remove and mkdir when source is a directory and target is a file', function () { const updated = FileUpdater.updatePathWithStats( testSourceDir, mockDirStats(), testTargetDir, mockFileStats(now)); expect(updated).toBe(true); expect(mockFs.cpPaths.length).toBe(0); expect(mockFs.rmPaths.length).toBe(1); expect(mockFs.mkdirPaths.length).toBe(1); expect(mockFs.rmPaths[0]).toBe(testTargetDir); expect(mockFs.mkdirPaths[0]).toBe(testTargetDir); });
it("Checking stopping of created server", () => { let server = new Server(SConfig.port); expect(server.stop()).toBe(false); server.destroy(); });
it('Test 003 : should return the same instance via "get" method', function () { expect(CordovaLogger.get()).toBeDefined(); expect(CordovaLogger.get()).toBe(CordovaLogger.get()); expect(CordovaLogger.get()).toEqual(jasmine.any(CordovaLogger)); });
it('Test 014 : should join the paths when a rootDir is specified', function () { FileUpdater.updatePathWithStats( testSourceFile, mockFileStats(now), testTargetFile, null, { rootDir: testRootDir }); expect(mockFs.cpPaths.length).toBe(1); expect(mockFs.rmPaths.length).toBe(0); expect(mockFs.cpPaths[0]).toEqual( [path.join(testRootDir, testSourceFile), path.join(testRootDir, testTargetFile)]); });
it('head() should safely return', function() { restangularAccounts.head().then(function() { expect(true).toBe(true); }); $httpBackend.flush(); });
it('Test 008 : should copy when a file exists at source and target and target is newer ' + 'and forcing update', function () { const updated = FileUpdater.updatePathWithStats( testSourceFile, mockFileStats(oneHourAgo), testTargetFile, mockFileStats(now), { all: true }); expect(updated).toBe(true); expect(mockFs.cpPaths.length).toBe(1); expect(mockFs.rmPaths.length).toBe(0); expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]); });
it('Test 011 : should remove when a file exists at target and not at source', function () { const updated = FileUpdater.updatePathWithStats( testSourceFile, null, testTargetFile, mockFileStats(now)); expect(updated).toBe(true); expect(mockFs.cpPaths.length).toBe(0); expect(mockFs.rmPaths.length).toBe(1); expect(mockFs.rmPaths[0]).toBe(testTargetFile); });
it('Test 009 : should copy when a file exists at source and target and source is newer', function () { const updated = FileUpdater.updatePathWithStats( testSourceFile, mockFileStats(now), testTargetFile, mockFileStats(oneHourAgo)); expect(updated).toBe(true); expect(mockFs.cpPaths.length).toBe(1); expect(mockFs.rmPaths.length).toBe(0); expect(mockFs.cpPaths[0]).toEqual([testSourceFile, testTargetFile]); });
// TODO: test error case for getEstimatedExchange it('should be able to get an estimated exchange amount', async(inject([SendPageDataService], (service: SendPageDataService) => { service.getEstimatedExchange('doge', 'btc', 2).then((data) => { expect(data).toBe(5) // MockChangellyService.getEstimatedExchange() returns 5 coins }) })))