Skip to content

Commit

Permalink
Add test for new feature of tagged projects
Browse files Browse the repository at this point in the history
  • Loading branch information
aggre committed Mar 28, 2018
1 parent 164b4e3 commit 6008669
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/elements/oo-projects/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ describe(`<${ELEMENT}></${ELEMENT}>`, () => {
expect(more).to.be.ok()
})

it('Fetch tagged public projects when exists "data-tag" attribute and not exists "data-iam" attribute value', async () => {
const element = insertElement(ELEMENT, new Map([['data-tag', 'test']]))
await sleep(300)
const items = element.shadowRoot.querySelectorAll('oo-atoms-message')
expect(items).to.have.length(2)

const more = element.shadowRoot.querySelector('.paging > oo-atoms-button')
expect(more).to.be.ok()
})

it('Show <oo-empty> when no projects exists', async () => {
const element: any = insertElement(ELEMENT, new Map([['data-iam', 'xxx']]))
await sleep(300)
Expand Down
63 changes: 63 additions & 0 deletions src/mock/stable/projects/publics/tag/test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
+++
[headers]
access-control-allow-origin = "http://localhost:9876"
access-control-expose-headers = "x-oo-count"
x-oo-count = 4
+++

```json
[
{
"uid": "xLNf8Zw9G3FUTetr",
"created": 1516380671346,
"Extensions": [
{
"key": "author",
"value": "test"
},
{
"key": "approve",
"value": true
},
{
"key": "users",
"value": ["test", "JEr9hsMH5m"]
},
{
"key": "body",
"value": "test"
},
{
"key": "tags",
"value": ["test"]
}
]
},
{
"uid": "y4Nd9DTGS74uUQss",
"created": 1516380661346,
"Extensions": [
{
"key": "author",
"value": "xxx"
},
{
"key": "approve",
"value": true
},
{
"key": "users",
"value": ["test", "xxx", "JEr9hsMH5m"]
},
{
"key": "body",
"value": "test"
},
{
"key": "tags",
"value": ["test"]
}
]
}
]
```

0 comments on commit 6008669

Please sign in to comment.