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; ...@@ -52,7 +52,7 @@ export default RepoFile;
</td> </td>
<td v-if="!isMini" class="hidden-xs"> <td v-if="!isMini" class="hidden-xs">
<span>{{timeFormated(file.lastCommitUpdate)}}</span> <span class="commit-update">{{timeFormated(file.lastCommitUpdate)}}</span>
</td> </td>
</tr> </tr>
</template> </template>
...@@ -2,12 +2,13 @@ import Vue from 'vue'; ...@@ -2,12 +2,13 @@ import Vue from 'vue';
import repoFile from '~/repo/repo_file.vue'; import repoFile from '~/repo/repo_file.vue';
describe('RepoFile', () => { describe('RepoFile', () => {
const updated = 'updated';
const file = { const file = {
icon: 'icon', icon: 'icon',
url: 'url', url: 'url',
name: 'name', name: 'name',
lastCommitMessage: 'message', lastCommitMessage: 'message',
lastCommitUpdate: 'update', lastCommitUpdate: Date.now(),
level: 10, level: 10,
}; };
const activeFile = { const activeFile = {
...@@ -22,6 +23,10 @@ describe('RepoFile', () => { ...@@ -22,6 +23,10 @@ describe('RepoFile', () => {
}).$mount(); }).$mount();
} }
beforeEach(() => {
spyOn(repoFile.mixins[0].methods, 'timeFormated').and.returnValue(updated);
});
it('renders link, icon, name and last commit details', () => { it('renders link, icon, name and last commit details', () => {
const vm = createComponent({ const vm = createComponent({
file, file,
...@@ -35,7 +40,7 @@ describe('RepoFile', () => { ...@@ -35,7 +40,7 @@ describe('RepoFile', () => {
expect(name.href).toMatch(`/${file.url}`); expect(name.href).toMatch(`/${file.url}`);
expect(name.textContent).toEqual(file.name); expect(name.textContent).toEqual(file.name);
expect(vm.$el.querySelector('.commit-message').textContent).toBe(file.lastCommitMessage); 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', () => { 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