Commit 18bc8543 authored by Luke "Jared" Bennett's avatar Luke "Jared" Bennett

Fix repo_file_spec

parent 0fdcb703
......@@ -52,7 +52,7 @@ export default RepoFile;
</td>
<td v-if="!isMini" class="hidden-xs">
<span>{{timeFormated(file.lastCommitUpdate)}}</span>
<span class="commit-update">{{timeFormated(file.lastCommitUpdate)}}</span>
</td>
</tr>
</template>
......@@ -2,12 +2,13 @@ import Vue from 'vue';
import repoFile from '~/repo/repo_file.vue';
describe('RepoFile', () => {
const updated = 'updated';
const file = {
icon: 'icon',
url: 'url',
name: 'name',
lastCommitMessage: 'message',
lastCommitUpdate: 'update',
lastCommitUpdate: Date.now(),
level: 10,
};
const activeFile = {
......@@ -22,6 +23,10 @@ describe('RepoFile', () => {
}).$mount();
}
beforeEach(() => {
spyOn(repoFile.mixins[0].methods, 'timeFormated').and.returnValue(updated);
});
it('renders link, icon, name and last commit details', () => {
const vm = createComponent({
file,
......@@ -35,7 +40,7 @@ describe('RepoFile', () => {
expect(name.href).toMatch(`/${file.url}`);
expect(name.textContent).toEqual(file.name);
expect(vm.$el.querySelector('.commit-message').textContent).toBe(file.lastCommitMessage);
expect(vm.$el.querySelector('.commit-update').textContent).toBe(file.lastCommitUpdate);
expect(vm.$el.querySelector('.commit-update').textContent).toBe(updated);
});
it('does render if hasFiles is true and is loading tree', () => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment