(t *testing.T)
| 1841 | } |
| 1842 | |
| 1843 | func TestMultiplesSortingOrderWithVarAndPredicate(t *testing.T) { |
| 1844 | s1 := testSchema + "\n" + `type Hostel { |
| 1845 | hosteslName: String! |
| 1846 | sections |
| 1847 | } |
| 1848 | |
| 1849 | type Section { |
| 1850 | section_id |
| 1851 | hostel |
| 1852 | } |
| 1853 | hosteslName: string @index(exact) . |
| 1854 | section_id: string @index(exact) . |
| 1855 | sections: [uid] @count . |
| 1856 | hostel:uid .` + "\n" |
| 1857 | |
| 1858 | setSchema(s1) |
| 1859 | triples := ` |
| 1860 | _:hostel1 <name> "Hostel Alpha" . |
| 1861 | _:hostel1 <sections> _:section1 . |
| 1862 | _:hostel1 <sections> _:section2 . |
| 1863 | |
| 1864 | _:section1 <section_id> "S1" . |
| 1865 | _:section2 <section_id> "S2" . |
| 1866 | |
| 1867 | _:hostel2 <name> "Hostel Beta" . |
| 1868 | _:hostel2 <sections> _:section3 . |
| 1869 | |
| 1870 | _:section3 <section_id> "S3" . |
| 1871 | |
| 1872 | _:hostel3 <name> "Hostel Gamma" . |
| 1873 | _:hostel3 <sections> _:section4 . |
| 1874 | _:hostel3 <sections> _:section5 . |
| 1875 | _:hostel3 <sections> _:section6 . |
| 1876 | |
| 1877 | _:section4 <section_id> "S4" . |
| 1878 | _:section5 <section_id> "S5" . |
| 1879 | _:section6 <section_id> "S6" . |
| 1880 | ` |
| 1881 | addTriplesToCluster(triples) |
| 1882 | |
| 1883 | query := `{ |
| 1884 | var(func: has(name)) { |
| 1885 | SECTIONS_COUNT as count(sections) |
| 1886 | } |
| 1887 | |
| 1888 | allHostels(func: has(name), orderdesc: |
| 1889 | val(SECTIONS_COUNT), orderasc: name) { |
| 1890 | uid |
| 1891 | name |
| 1892 | sections { |
| 1893 | section_id |
| 1894 | } |
| 1895 | totalSections: val(SECTIONS_COUNT) |
| 1896 | } |
| 1897 | }` |
| 1898 | |
| 1899 | // should return error |
| 1900 | _, err := processQuery(context.Background(), t, query) |
nothing calls this directly
no test coverage detected