Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('returns the status of only that path2', () => {
fs.writeFileSync(filePath, '', 'utf8')
const statuses = repo.getStatusForPaths(['dir/**'])
expect(_.keys(statuses).length).toBe(0)
})
})
it('gets the status based on the files inside the directory', () => {
expect(
repo.isStatusModified(repo.getDirectoryStatus(directoryPath))
).toBe(false);
fs.writeFileSync(filePath, 'abc');
repo.getPathStatus(filePath);
expect(
repo.isStatusModified(repo.getDirectoryStatus(directoryPath))
).toBe(true);
});
});
it('trigger a status-changed event when the new status differs from the last cached one', () => {
const statusHandler = jasmine.createSpy('statusHandler');
repo.onDidChangeStatus(statusHandler);
fs.writeFileSync(filePath, '');
let status = repo.getPathStatus(filePath);
expect(statusHandler.callCount).toBe(1);
expect(statusHandler.argsForCall[0][0]).toEqual({
path: filePath,
pathStatus: status
});
fs.writeFileSync(filePath, 'abc');
status = repo.getPathStatus(filePath);
expect(statusHandler.callCount).toBe(1);
});
});
beforeEach(() => {
repoDirectory = temp.mkdirSync('node-git-repo-')
wrench.copyDirSyncRecursive(path.join(__dirname, 'fixtures/subdir.git'), path.join(repoDirectory, '.git'))
repo = git.open(repoDirectory)
const dir = path.join(repo.getWorkingDirectory(), 'dir')
filePath = path.join(dir, 'a.txt')
fs.writeFileSync(filePath, 'hey there', 'utf8')
})
generateYoctoConfig(folder: string) {
const filePath = path.join(folder, LocalConstants.configFileName);
if (!fs.existsSync(filePath)) {
const config:
RaspberryPiYoctoConfig = {output: LocalConstants.defaultOutputPath};
fs.writeFileSync(filePath, JSON.stringify(config, null, 4));
}
}
}